Skip to content

Commit

Permalink
Peel alias for auto variables
Browse files Browse the repository at this point in the history
  • Loading branch information
deadalnix committed Jul 31, 2016
1 parent f465864 commit caaf621
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libd/src/d/semantic/symbol.d
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,12 @@ struct SymbolAnalyzer {

private void analyzeVarLike(V)(VariableDeclaration d, V v) {
auto value = getValue(d);
v.type = value.type;

// We peel alias for auto variable as it can lead to
// very confusing results, like a template parameter.
v.type = d.type.isAuto
? value.type.getCanonical()
: value.type;

assert(value);
static if (is(typeof(v.value) : CompileTimeExpression)) {
Expand Down

0 comments on commit caaf621

Please sign in to comment.