summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/default-expr-arguments.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/default-expr-arguments.cpp')
-rw-r--r--test/SemaTemplate/default-expr-arguments.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index 9c0f1ec..34ac2d9 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -65,8 +65,8 @@ void test_x0(X0<int> xi) {
xi.f(17);
}
-struct NotDefaultConstructible { // expected-note{{candidate}}
- NotDefaultConstructible(int); // expected-note{{candidate}}
+struct NotDefaultConstructible { // expected-note 2{{candidate}}
+ NotDefaultConstructible(int); // expected-note 2{{candidate}}
};
void test_x0_not_default_constructible(X0<NotDefaultConstructible> xn) {
@@ -85,6 +85,18 @@ void test_X1() {
X1<int> x1;
}
+template<typename T>
+struct X2 {
+ void operator()(T = T()); // expected-error{{no matching}}
+};
+
+void test_x2(X2<int> x2i, X2<NotDefaultConstructible> x2n) {
+ x2i();
+ x2i(17);
+ x2n(NotDefaultConstructible(17));
+ x2n(); // expected-note{{in instantiation of default function argument}}
+}
+
// PR5283
namespace PR5283 {
template<typename T> struct A {
@@ -108,3 +120,27 @@ struct D {
};
D::D() { } // expected-note {{in instantiation of default function argument expression for 'A<int *>' required he}}
}
+
+// PR5301
+namespace pr5301 {
+ void f(int, int = 0);
+
+ template <typename T>
+ void g(T, T = 0);
+
+ template <int I>
+ void i(int a = I);
+
+ template <typename T>
+ void h(T t) {
+ f(0);
+ g(1);
+ g(t);
+ i<2>();
+ }
+
+ void test() {
+ h(0);
+ }
+}
+
OpenPOWER on IntegriCloud