diff --git a/src/dmd/cli.d b/src/dmd/cli.d index 8fca0b43b8fe..ed73b021dd87 100644 --- a/src/dmd/cli.d +++ b/src/dmd/cli.d @@ -731,6 +731,7 @@ dmd -cov -unittest myprog.d /// Returns all available reverts static immutable reverts = [ Feature("dip25", "noDIP25", "revert DIP25 changes https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md"), + Feature("aliasaggquals", "noAliasAggQuals", "drop qualifiers when passing an aggregate type as a template alias parameter"), ]; /// Returns all available previews diff --git a/src/dmd/dtemplate.d b/src/dmd/dtemplate.d index f71412cbb81a..bdd009f9e48f 100644 --- a/src/dmd/dtemplate.d +++ b/src/dmd/dtemplate.d @@ -8083,7 +8083,7 @@ MATCH matchArg(TemplateParameter tp, Scope* sc, RootObject oarg, size_t i, Templ { // Don't lose type qualifiers // https://issues.dlang.org/show_bug.cgi?id=20863 - if (ta && ta.mod) + if (!global.params.noAliasAggQuals && ta && ta.mod) sa = oarg; m = MATCH.convert; } diff --git a/src/dmd/globals.d b/src/dmd/globals.d index 1832991aa2b3..d4a422b4336c 100644 --- a/src/dmd/globals.d +++ b/src/dmd/globals.d @@ -152,6 +152,7 @@ extern (C++) struct Param bool useDIP25; // implement http://wiki.dlang.org/DIP25 bool noDIP25; // revert to pre-DIP25 behavior bool useDIP1021; // implement https://github.com/dlang/DIPs/blob/master/DIPs/DIP1021.md + bool noAliasAggQuals; // drop qualifiers when passing an aggregate type as a template alias parameter bool release; // build release version bool preservePaths; // true means don't strip path from source file DiagnosticReporting warnings = DiagnosticReporting.off; // how compiler warnings are handled diff --git a/test/compilable/reverthelp.d b/test/compilable/reverthelp.d index aaf55f26ca2d..13775d431421 100644 --- a/test/compilable/reverthelp.d +++ b/test/compilable/reverthelp.d @@ -6,5 +6,6 @@ TEST_OUTPUT: Revertable language changes listed by -revert=name: =all list information on all revertable language changes =dip25 revert DIP25 changes https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md + =aliasaggquals drop qualifiers when passing an aggregate type as a template alias parameter ---- */