diff options
author | Bill Wendling <isanbard@gmail.com> | 2014-08-04 04:34:53 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2014-08-04 04:34:53 +0000 |
commit | 9efbb8e0f658e1aa793711f84c15ef0fe2feccef (patch) | |
tree | 9304492a5eae2fbc66a40892d08e5bacae7c7f8e | |
parent | bf3eda5d19f8180e79b3597bf826c56c037f30cf (diff) |
Merging r213611:
------------------------------------------------------------------------
r213611 | rtrieu | 2014-07-21 21:06:54 -0700 (Mon, 21 Jul 2014) | 2 lines
More gracefully handle parentheses in templare arguments in template diffing.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_35@214691 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ASTDiagnostic.cpp | 3 | ||||
-rw-r--r-- | test/Misc/diag-template-diffing.cpp | 6 |
2 files changed, 7 insertions, 2 deletions
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<DeclRefExpr>(ArgExpr); if (!DRE) { - DRE = cast<DeclRefExpr>(cast<UnaryOperator>(ArgExpr)->getSubExpr()); + DRE = cast<DeclRefExpr>( + cast<UnaryOperator>(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 <class T> Wrapper<T> MakeWrapper(); -int global; +int global, global2; constexpr int * ptr = nullptr; Wrapper<S<ptr>> W = MakeWrapper<S<&global>>(); // Don't print an extra '&' for 'ptr' // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<ptr>>' + +Wrapper<S<(&global2)>> W2 = MakeWrapper<S<&global>>(); +// Handle parens correctly +// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<global2>>' } // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated. |