diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 26ff6f3b7d..a3df189a61 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -2042,7 +2042,11 @@ Expr *Expr::IgnoreParenCasts() { E = Materialize->GetTemporaryExpr(); continue; } - + if (SubstNonTypeTemplateParmExpr *NTTP + = dyn_cast(E)) { + E = NTTP->getReplacement(); + continue; + } return E; } } @@ -2076,6 +2080,10 @@ Expr *Expr::IgnoreParenLValueCasts() { = dyn_cast(E)) { E = Materialize->GetTemporaryExpr(); continue; + } else if (SubstNonTypeTemplateParmExpr *NTTP + = dyn_cast(E)) { + E = NTTP->getReplacement(); + continue; } break; } @@ -2110,6 +2118,11 @@ Expr *Expr::IgnoreParenImpCasts() { E = Materialize->GetTemporaryExpr(); continue; } + if (SubstNonTypeTemplateParmExpr *NTTP + = dyn_cast(E)) { + E = NTTP->getReplacement(); + continue; + } return E; } } @@ -2167,6 +2180,12 @@ Expr *Expr::IgnoreParenNoopCasts(ASTContext &Ctx) { } } + if (SubstNonTypeTemplateParmExpr *NTTP + = dyn_cast(E)) { + E = NTTP->getReplacement(); + continue; + } + return E; } }