summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/instantiate-expr-1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/instantiate-expr-1.cpp')
-rw-r--r--test/SemaTemplate/instantiate-expr-1.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp
index d1b05f6..37145b6 100644
--- a/test/SemaTemplate/instantiate-expr-1.cpp
+++ b/test/SemaTemplate/instantiate-expr-1.cpp
@@ -137,3 +137,36 @@ void test_asm() {
int b;
test_asm(b); // expected-note {{in instantiation of function template specialization 'test_asm<int>' requested here}}
}
+
+namespace PR6424 {
+ template<int I> struct X {
+ X() {
+ int *ip = I; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+ }
+ };
+
+ template<int> struct Y {
+ typedef X<7> X7;
+
+ void f() { X7(); } // expected-note{{instantiation}}
+ };
+
+ template void Y<3>::f();
+
+ template<int I>
+ struct X2 {
+ void *operator new(__SIZE_TYPE__) {
+ int *ip = I; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+ return ip;
+ }
+ };
+
+ template<int> struct Y2 {
+ typedef X2<7> X;
+ void f() {
+ new X(); // expected-note{{instantiation of}}
+ }
+ };
+
+ template void Y2<3>::f();
+}
OpenPOWER on IntegriCloud