diff --git a/compiler/src/dmd/hdrgen.d b/compiler/src/dmd/hdrgen.d index 8c4f0e4355c7..86131f2f11c9 100644 --- a/compiler/src/dmd/hdrgen.d +++ b/compiler/src/dmd/hdrgen.d @@ -3796,7 +3796,8 @@ private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, ref HdrGenSt } else if (Expression e = isExpression(oarg)) { - if (e.op == EXP.int64 || e.op == EXP.float64 || e.op == EXP.null_ || e.op == EXP.string_ || e.op == EXP.this_) + if (!(e.type && e.type.isTypeEnum()) && e.op == EXP.int64 || e.op == EXP.float64 || + e.op == EXP.null_ || e.op == EXP.string_ || e.op == EXP.this_) { toCBuffer(e, buf, hgs); return; diff --git a/compiler/test/fail_compilation/template_enum_param.d b/compiler/test/fail_compilation/template_enum_param.d new file mode 100644 index 000000000000..79fb5e4d8f85 --- /dev/null +++ b/compiler/test/fail_compilation/template_enum_param.d @@ -0,0 +1,17 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/template_enum_param.d(15): Error: static assert: `false` is false +fail_compilation/template_enum_param.d(17): instantiated from here: `X!(E.a)` +--- +*/ + +enum E +{ + a,b,c +} +template X(E e) +{ + static assert(false); +} +alias Y = X!(E.a);