summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/cxx1z-class-template-argument-deduction.cpp')
-rw-r--r--test/SemaCXX/cxx1z-class-template-argument-deduction.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
index 668c242802..9232a8b6eb 100644
--- a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -286,6 +286,29 @@ namespace tuple_tests {
}
}
+namespace dependent {
+ template<typename T> struct X {
+ X(T);
+ };
+ template<typename T> int Var(T t) {
+ X x(t);
+ return X(x) + 1; // expected-error {{invalid operands}}
+ }
+ template<typename T> int Cast(T t) {
+ return X(X(t)) + 1; // expected-error {{invalid operands}}
+ }
+ template<typename T> int New(T t) {
+ return X(new X(t)) + 1; // expected-error {{invalid operands}}
+ };
+ template int Var(float); // expected-note {{instantiation of}}
+ template int Cast(float); // expected-note {{instantiation of}}
+ template int New(float); // expected-note {{instantiation of}}
+ template<typename T> int operator+(X<T>, int);
+ template int Var(int);
+ template int Cast(int);
+ template int New(int);
+}
+
#else
// expected-no-diagnostics