Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / class / class.mem / p1b.cpp
blob3e8c985305991b62daf99e9b0c9b3848554b41df
1 // The first run checks that the correct errors are generated,
2 // implicitly checking the order of default argument parsing:
3 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 // The second run checks the order of inline method definitions:
5 // RUN: not %clang_cc1 -fsyntax-only %s 2> %t
6 // RUN: FileCheck %s < %t
8 class A {
9 public:
10 void a1() {
11 B b = B();
14 class B;
15 void a2(B b = B()); // expected-error{{use of default argument to function 'B' that is declared later in class 'B'}}
17 void a3(int a = 42);
19 // CHECK: error: use of undeclared identifier 'first'
20 void a4(int a = first); // expected-error{{use of undeclared identifier 'first'}}
22 class B {
23 public:
24 B(int b = 42) { // expected-note{{default argument declared here}}
25 A a;
26 a.a3();
27 a.a6();
30 void b1(A a = A()); // expected-error{{use of default argument to function 'A' that is declared later in class 'A'}}
32 // CHECK: error: use of undeclared identifier 'second'
33 void b2(int a = second); // expected-error{{use of undeclared identifier 'second'}}
36 void a5() {
37 B b = B();
40 void a6(B b = B());
42 A(int a = 42); // expected-note{{default argument declared here}}
44 // CHECK: error: use of undeclared identifier 'third'
45 void a7(int a = third); // expected-error{{use of undeclared identifier 'third'}}