It's an error to use a function declared in a class definition as a default argument before the function has been declared.
llvm-svn: 73234
diff --git a/clang/test/SemaCXX/default2.cpp b/clang/test/SemaCXX/default2.cpp
index f99e454..edbd6b3 100644
--- a/clang/test/SemaCXX/default2.cpp
+++ b/clang/test/SemaCXX/default2.cpp
@@ -115,9 +115,15 @@
}
struct ZZ {
- void f(ZZ z = g()); // expected-error{{no matching constructor for initialization}}
-
static ZZ g(int = 17);
+ void f(ZZ z = g()); // expected-error{{no matching constructor for initialization}}
+
ZZ(ZZ&, int = 17); // expected-note{{candidate function}}
};
+
+// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325
+class C2 {
+ static void g(int = f()); // expected-error{{use of default argument to function 'f' that is declared later in class 'C2'}}
+ static int f(int = 10); // expected-note{{default argument declared here}}
+};