]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Add testcase for now fixed issue [PR117324]
authorSimon Martin <simon@nasilyan.com>
Sun, 16 Feb 2025 10:00:19 +0000 (11:00 +0100)
committerSimon Martin <simon@nasilyan.com>
Sun, 16 Feb 2025 10:00:27 +0000 (11:00 +0100)
The case in this PR does not ICE anymore after the fix for PR118319.

This patch simply adds the case to the testsuite.

PR c++/117324

gcc/testsuite/ChangeLog:

* g++.dg/parse/defarg19.C: New test.

gcc/testsuite/g++.dg/parse/defarg19.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/parse/defarg19.C b/gcc/testsuite/g++.dg/parse/defarg19.C
new file mode 100644 (file)
index 0000000..df0819a
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/117324
+// { dg-do "compile" { target c++11 } }
+
+template<typename = int>
+struct ct1 {
+  friend void f(ct1, // { dg-error "specifies default" }
+               int = [](int p = [] {}) { return p; }(); ) // { dg-error "expected|declares a non-template" }
+  {}
+};
+void test() {
+  f(ct1{}); // { dg-error "missing template arguments|not declared" "" { target c++14_down } }
+}