blob: 0f0505f983cd23109fe3963d195b673d1465733f [file] [log] [blame]
Richard Smith7984de32012-01-12 23:53:29 +00001// RUN: %clang_cc1 -verify -x c++ %s
2// RUN: %clang_cc1 -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s
3
4struct S {
5 int n;
6};
7
8struct T {
9 T();
10 int n;
11};
12
13struct U {
14 ~U();
15 int n;
16};
17
18struct V {
19 ~V();
20};
21
22struct W : V {
23};
24
25struct X : U {
26};
27
28int F1();
29S F2();
30
31namespace N {
32 void test() {
33 // CHECK: fix-it:"{{.*}}":{34:9-34:11}:" = {}"
34 S s1(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
35
36 // CHECK: fix-it:"{{.*}}":{38:9-38:10}:";"
37 // CHECK: fix-it:"{{.*}}":{39:7-39:9}:" = {}"
38 S s2, // expected-note {{change this ',' to a ';' to call 'F2'}}
39 F2(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
40
41 // CHECK: fix-it:"{{.*}}":{43:9-43:11}:""
42 // CHECK: fix-it:"{{.*}}":{44:9-44:11}:""
43 T t1(), // expected-warning {{function declaration}} expected-note {{remove parentheses}}
44 t2(); // expected-warning {{function declaration}} expected-note {{remove parentheses}}
45
46 // CHECK: fix-it:"{{.*}}":{47:8-47:10}:" = {}"
47 U u(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
48
49 // CHECK: fix-it:"{{.*}}":{50:8-50:10}:""
50 V v(); // expected-warning {{function declaration}} expected-note {{remove parentheses}}
51
52 // CHECK: fix-it:"{{.*}}":{53:8-53:10}:""
53 W w(); // expected-warning {{function declaration}} expected-note {{remove parentheses}}
54
55 // TODO: Removing the parens here would not initialize U::n.
56 // Maybe suggest an " = X()" initializer for this case?
57 // Maybe suggest removing the parens anyway?
58 X x(); // expected-warning {{function declaration}}
59
60 // CHECK: fix-it:"{{.*}}":{61:11-61:13}:" = 0"
61 int n1(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
62
63 // CHECK: fix-it:"{{.*}}":{65:11-65:12}:";"
64 // CHECK: fix-it:"{{.*}}":{66:7-66:9}:" = 0"
65 int n2, // expected-note {{change this ',' to a ';' to call 'F1'}}
66 F1(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
67
68 // CHECK: fix-it:"{{.*}}":{69:13-69:15}:" = 0.0"
69 double d(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
70
71 typedef void *Ptr;
72
73 // CHECK: fix-it:"{{.*}}":{74:10-74:12}:" = 0"
74 Ptr p(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
75
76#define NULL 0
77 // CHECK: fix-it:"{{.*}}":{78:10-78:12}:" = NULL"
78 Ptr p(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
79 }
80}