Debian Codegraph @

gcc/testsuite/g++.dg/parse/pr34758.C

raw
1 // PR 34758 Bad diagnostic for circular dependency in constructor default argument
2 // { dg-do compile }
3 // { dg-options "" }
4 struct A
5 {
6 A (const A& = A()); // { dg-error "recursive evaluation of default argument" }
7 };
8
9
10 struct S {
11 S(const S& = f()); // { dg-error "default argument\[^\n\]*which is not yet defined" }
12 static const S& f(int i = 3);
13 };
14
15 struct J {
16 J(const J& = f(2)); // { dg-error "default argument.*which is not yet defined" }
17 static const J& f(int i = 3, int j = 4);
18 };
19
20 struct Z {
21 Z(const Z& = f(4));
22 static const Z& f(int i = 3);
23 };
24
25 struct X {
26 X(const X& = g());
27 static const X& g(void);
28 };