1 // RUN: %clang_cc1 -verify -x c++ %s 2 // RUN: %clang_cc1 -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s 3 4 struct S { 5 int n; 6 }; 7 8 struct T { 9 T(); 10 int n; 11 }; 12 13 struct U { 14 ~U(); 15 int n; 16 }; 17 18 struct V { 19 ~V(); 20 }; 21 22 struct W : V { 23 }; 24 25 struct X : U { 26 }; 27 28 int F1(); 29 S F2(); 30 31 namespace N { test()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 // CHECK: fix-it:"{{.*}}":{81:11-81:13}:" = false" 81 bool b(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}} 82 83 // CHECK: fix-it:"{{.*}}":{84:11-84:13}:" = '\\0'" 84 char c(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}} 85 86 // CHECK: fix-it:"{{.*}}":{87:15-87:17}:" = L'\\0'" 87 wchar_t wc(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}} 88 } 89 } 90