re PR c++/83020 (('17) Class template constructor call skipped with no error when...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 21 Nov 2017 15:36:25 +0000 (15:36 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 21 Nov 2017 15:36:25 +0000 (15:36 +0000)
2017-11-21  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/83020
* g++.dg/cpp1z/pr83020.C: New.

From-SVN: r255006

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/pr83020.C [new file with mode: 0644]

index b508745c5ad6698f1053a204d39b588eec7c27f9..8a376ff17028702a36c0831eaf83aaed99017d24 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/83020
+       * g++.dg/cpp1z/pr83020.C: New.
+
 2017-11-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/82880
diff --git a/gcc/testsuite/g++.dg/cpp1z/pr83020.C b/gcc/testsuite/g++.dg/cpp1z/pr83020.C
new file mode 100644 (file)
index 0000000..43a7e38
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/83020
+// { dg-options -std=c++17 }
+
+struct NoDefault {
+    int val = 1234;
+    NoDefault(int v) : val(v) {}
+};
+template <class T>
+struct Whoops {
+    const char *str;
+    T obj;
+    Whoops(const char *s, T v = T()) : str(s), obj(v) {}  // { dg-error "no matching" }
+};
+const char *test() {
+    return Whoops<NoDefault>("hi").str;
+}