[flang] Update CommandTest for AIX (NFC) (#118403)
[llvm-project.git] / clang / test / CXX / dcl.decl / dcl.meaning / dcl.fct.default / p4.cpp
blob6014268a18601078c54a608b7f19e961861ad7e0
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 void f0(int i, int j, int k = 3);
4 void f0(int i, int j, int k);
5 void f0(int i, int j = 2, int k);
6 void f0(int i, int j, int k);
7 void f0(int i = 1, // expected-note{{previous definition}}
8 int j, int k);
9 void f0(int i, int j, int k); // want 2 decls before next default arg
10 void f0(int i, int j, int k);
12 namespace N0 {
13 void f0(int, int, int); // expected-note{{candidate}}
15 void test_f0_inner_scope() {
16 f0(); // expected-error{{no matching}}
20 void test_f0_outer_scope() {
21 f0(); // okay
24 void f0(int i = 1, // expected-error{{redefinition of default argument}}
25 int, int);
27 template<typename T> void f1(T); // expected-note{{previous}}
29 template<typename T>
30 void f1(T = T()); // expected-error{{cannot be added}}
33 namespace N1 {
34 // example from C++03 standard
35 // FIXME: make these "f2"s into "f"s, then fix our scoping issues
36 void f2(int, int);
37 void f2(int, int = 7);
38 void h() {
39 f2(3); // OK, calls f(3, 7)
40 void f(int = 1, int); // expected-error{{missing default argument}}
43 void m()
45 void f(int, int); // expected-note{{'f' declared here}}
46 f(4); // expected-error{{too few arguments to function call}}
47 void f(int, int = 5); // expected-note{{previous definition}}
48 f(4); // okay
49 void f(int, int = 5); // expected-error{{redefinition of default argument}}
52 void n()
54 f2(6); // okay
59 namespace PR18432 {
61 struct A {
62 struct B {
63 static void Foo (int = 0);
66 // should not hide default args
67 friend void B::Foo (int);
70 void Test ()
72 A::B::Foo ();
75 } // namespace
77 namespace pr12724 {
79 void func_01(bool param = true);
80 class C01 {
81 public:
82 friend void func_01(bool param);
85 void func_02(bool param = true);
86 template<typename T>
87 class C02 {
88 public:
89 friend void func_02(bool param);
91 C02<int> c02;
93 void func_03(bool param);
94 template<typename T>
95 class C03 {
96 public:
97 friend void func_03(bool param);
99 void func_03(bool param = true);
100 C03<int> c03;
102 void main() {
103 func_01();
104 func_02();
105 func_03();
108 } // namespace pr12724