1efc46958SDouglas Gregor // The first run checks that the correct errors are generated, 2efc46958SDouglas Gregor // implicitly checking the order of default argument parsing: 3efc46958SDouglas Gregor // RUN: %clang_cc1 -fsyntax-only -verify %s 4efc46958SDouglas Gregor // The second run checks the order of inline method definitions: 5efc46958SDouglas Gregor // RUN: not %clang_cc1 -fsyntax-only %s 2> %t 6efc46958SDouglas Gregor // RUN: FileCheck %s < %t 7efc46958SDouglas Gregor 8efc46958SDouglas Gregor class A { 9efc46958SDouglas Gregor public: a1()10efc46958SDouglas Gregor void a1() { 11efc46958SDouglas Gregor B b = B(); 12efc46958SDouglas Gregor } 13efc46958SDouglas Gregor 14efc46958SDouglas Gregor class B; 15efc46958SDouglas Gregor void a2(B b = B()); // expected-error{{use of default argument to function 'B' that is declared later in class 'B'}} 16efc46958SDouglas Gregor 17efc46958SDouglas Gregor void a3(int a = 42); 18efc46958SDouglas Gregor 19*ae700c97SRichard Trieu // CHECK: error: use of undeclared identifier 'first' 20efc46958SDouglas Gregor void a4(int a = first); // expected-error{{use of undeclared identifier 'first'}} 21efc46958SDouglas Gregor 22efc46958SDouglas Gregor class B { 23efc46958SDouglas Gregor public: B(int b=42)24efc46958SDouglas Gregor B(int b = 42) { // expected-note{{default argument declared here}} 25efc46958SDouglas Gregor A a; 26efc46958SDouglas Gregor a.a3(); 27efc46958SDouglas Gregor a.a6(); 28efc46958SDouglas Gregor } 29efc46958SDouglas Gregor 30efc46958SDouglas Gregor void b1(A a = A()); // expected-error{{use of default argument to function 'A' that is declared later in class 'A'}} 31efc46958SDouglas Gregor 32efc46958SDouglas Gregor // CHECK: error: use of undeclared identifier 'second' 33efc46958SDouglas Gregor void b2(int a = second); // expected-error{{use of undeclared identifier 'second'}} 34efc46958SDouglas Gregor }; 35efc46958SDouglas Gregor a5()36efc46958SDouglas Gregor void a5() { 37efc46958SDouglas Gregor B b = B(); 38efc46958SDouglas Gregor } 39efc46958SDouglas Gregor 40efc46958SDouglas Gregor void a6(B b = B()); 41efc46958SDouglas Gregor 42efc46958SDouglas Gregor A(int a = 42); // expected-note{{default argument declared here}} 43efc46958SDouglas Gregor 44efc46958SDouglas Gregor // CHECK: error: use of undeclared identifier 'third' 45efc46958SDouglas Gregor void a7(int a = third); // expected-error{{use of undeclared identifier 'third'}} 46efc46958SDouglas Gregor }; 47