summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ASTDiagnostic.cpp3
-rw-r--r--clang/test/Misc/diag-template-diffing.cpp6
2 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 15e288acb9a..20540f3ce12 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/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/clang/test/Misc/diag-template-diffing.cpp b/clang/test/Misc/diag-template-diffing.cpp
index 41cdca47126..391915ee970 100644
--- a/clang/test/Misc/diag-template-diffing.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud