]> granicus.if.org Git - clang/commitdiff
Merging r213611:
authorBill Wendling <isanbard@gmail.com>
Mon, 4 Aug 2014 04:34:53 +0000 (04:34 +0000)
committerBill Wendling <isanbard@gmail.com>
Mon, 4 Aug 2014 04:34:53 +0000 (04:34 +0000)
------------------------------------------------------------------------
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

lib/AST/ASTDiagnostic.cpp
test/Misc/diag-template-diffing.cpp

index 15e288acb9a30781ca831f64bc2072c8df880dd4..20540f3ce128a23a06c18d4124267268fb38d3a2 100644 (file)
@@ -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();
index 41cdca47126ae45b51136d9e44229f2c8d937465..391915ee970e1f7bf7d5eece987f59872ffaa6c6 100644 (file)
@@ -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.