summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-try-catch.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-18 21:08:14 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-18 21:08:14 +0000
commit2f2433f2c4965640e3eea62c87deb7292492b10f (patch)
treef588d5afa5e57a6261deeacbb5e28cbcb772c464 /test/SemaTemplate/instantiate-try-catch.cpp
parent725165f2846bd37d3aaf863747fa30126992085e (diff)
downloadclang-2f2433f2c4965640e3eea62c87deb7292492b10f.tar.gz
clang-2f2433f2c4965640e3eea62c87deb7292492b10f.tar.bz2
clang-2f2433f2c4965640e3eea62c87deb7292492b10f.tar.xz
Deal with an icky corner case where we were complaining that a catch
statement was using an rvalue reference during the template definition. However, template instantiations based on an lvalue reference type are well-formed, so we delay checking of these property until template instantiation time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-try-catch.cpp')
-rw-r--r--test/SemaTemplate/instantiate-try-catch.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-try-catch.cpp b/test/SemaTemplate/instantiate-try-catch.cpp
new file mode 100644
index 0000000000..074afa9d17
--- /dev/null
+++ b/test/SemaTemplate/instantiate-try-catch.cpp
@@ -0,0 +1,14 @@
+// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+
+template<typename T> struct TryCatch0 {
+ void f() {
+ try {
+ } catch (T&&) { // expected-error 2{{cannot catch exceptions by rvalue reference}}
+ }
+ }
+};
+
+template struct TryCatch0<int&>; // okay
+template struct TryCatch0<int&&>; // expected-note{{instantiation}}
+template struct TryCatch0<int>; // expected-note{{instantiation}}
+