From: Richard Trieu Date: Tue, 22 Jul 2014 04:06:54 +0000 (+0000) Subject: More gracefully handle parentheses in templare arguments in template diffing. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d1015f2df83d298ffa9b68d9791ece9db9656b8;p=clang More gracefully handle parentheses in templare arguments in template diffing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213611 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp index 15e288acb9..20540f3ce1 100644 --- a/lib/AST/ASTDiagnostic.cpp +++ b/lib/AST/ASTDiagnostic.cpp @@ -1184,7 +1184,8 @@ class TemplateDiff { } DeclRefExpr *DRE = dyn_cast(ArgExpr); if (!DRE) { - DRE = cast(cast(ArgExpr)->getSubExpr()); + DRE = cast( + cast(ArgExpr->IgnoreParens())->getSubExpr()); } return DRE->getDecl(); diff --git a/test/Misc/diag-template-diffing.cpp b/test/Misc/diag-template-diffing.cpp index 41cdca4712..391915ee97 100644 --- a/test/Misc/diag-template-diffing.cpp +++ b/test/Misc/diag-template-diffing.cpp @@ -1114,11 +1114,15 @@ struct Wrapper {}; template Wrapper MakeWrapper(); -int global; +int global, global2; constexpr int * ptr = nullptr; Wrapper> W = MakeWrapper>(); // Don't print an extra '&' for 'ptr' // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper>' to 'Wrapper>' + +Wrapper> W2 = MakeWrapper>(); +// Handle parens correctly +// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper>' to 'Wrapper>' } // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.