diff options
author | Richard Trieu <rtrieu@google.com> | 2013-05-07 21:36:24 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2013-05-07 21:36:24 +0000 |
commit | 091872c5df50fc734be3074536a6184748225f40 (patch) | |
tree | 7cc6cdb7cecc3603f539eb2104b944b61b94a026 /clang/test/Misc/diag-template-diffing.cpp | |
parent | 1fd4365f9172eeb55285cac91d4d9bb880a37bae (diff) | |
download | bcm5719-llvm-091872c5df50fc734be3074536a6184748225f40.tar.gz bcm5719-llvm-091872c5df50fc734be3074536a6184748225f40.zip |
Fix crash on invalid in template type diffing.
This is a fix for PR15895, where Clang will crash when trying to print a
template diff and the template uses an address of operator. This resulted
from expecting a DeclRefExpr when the Expr could have also been
UnaryOperator->DeclRefExpr.
llvm-svn: 181365
Diffstat (limited to 'clang/test/Misc/diag-template-diffing.cpp')
-rw-r--r-- | clang/test/Misc/diag-template-diffing.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Misc/diag-template-diffing.cpp b/clang/test/Misc/diag-template-diffing.cpp index add96efd37b..bee868fb8a5 100644 --- a/clang/test/Misc/diag-template-diffing.cpp +++ b/clang/test/Misc/diag-template-diffing.cpp @@ -1002,6 +1002,33 @@ namespace VariadicDefault { } } +namespace PointerArguments { + template <int *p> class T {}; + template <int* ...> class U {}; + int a, b, c; + int z[5]; + void test() { + T<&a> ta; + T<z> tz; + T<&b> tb(ta); + // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&b>' + // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<&a>' to 'const T<&b>' for 1st argument + T<&c> tc(tz); + // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&c>' + // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<z>' to 'const T<&c>' for 1st argument + + U<&a, &a> uaa; + U<&b> ub(uaa); + // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b>' + // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'U<&a, &a>' to 'const U<&b, (no argument)>' for 1st argument + + U<&b, &b, &b> ubbb(uaa); + // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b, &b, &b>' + // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'U<&a, &a, (no argument)>' to 'const U<&b, &b, &b>' for 1st argument + + } +} + // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated. // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated. // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated. |