summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-09-25 04:46:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-09-25 04:46:05 +0000
commit88d67f341279de9752f4471f6e887c56526e18d5 (patch)
tree782f415917a00721b6726e7c568a400e4b516edd /clang/test
parent2603a1876967aebb2a8319dfbc9f58d049ff60e7 (diff)
downloadbcm5719-llvm-88d67f341279de9752f4471f6e887c56526e18d5.tar.gz
bcm5719-llvm-88d67f341279de9752f4471f6e887c56526e18d5.zip
Fix crash when a decltype expression in a trailing return type refers to the
function being instantiated. An error recovery codepath was recursively performing name lookup (and triggering an unbounded stack of template instantiations which blew out the stack before hitting the depth limit). Patch by Wei Pan! llvm-svn: 164586
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/trailing-return-0x.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/trailing-return-0x.cpp b/clang/test/SemaCXX/trailing-return-0x.cpp
index c219b77d9e4..462b4fa3da0 100644
--- a/clang/test/SemaCXX/trailing-return-0x.cpp
+++ b/clang/test/SemaCXX/trailing-return-0x.cpp
@@ -69,3 +69,19 @@ X<int> xx;
only<int> p2 = xx.f(0L);
only<double> p3 = xx.g(0L, 1.0);
only<double> p4 = xx.get_nested<double>().h(0L, 1.0, 3.14f);
+
+namespace PR12053 {
+ template <typename T>
+ auto f1(T t) -> decltype(f1(t)) {} // expected-note{{candidate template ignored}}
+
+ void test_f1() {
+ f1(0); // expected-error{{no matching function for call to 'f1'}}
+ }
+
+ template <typename T>
+ auto f2(T t) -> decltype(f2(&t)) {} // expected-note{{candidate template ignored}}
+
+ void test_f2() {
+ f2(0); // expected-error{{no matching function for call to 'f2'}}
+ }
+}
OpenPOWER on IntegriCloud