• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -verify -std=c++11 %s
2 // RUN: cp %s %t
3 // RUN: not %clang_cc1 -x c++ -std=c++11 -fixit %t
4 // RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++11 %t
5 // RUN: not %clang_cc1 -std=c++11 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
6 
7 namespace ClassSpecifier {
8   class [[]] [[]]
9     attr_after_class_name_decl [[]] [[]]; // expected-error {{an attribute list cannot appear here}}
10     // CHECK: fix-it:{{.*}}:{9:5-9:5}
11     // CHECK: fix-it:{{.*}}:{9:32-9:41}
12 
13   class [[]] [[]]
14    attr_after_class_name_definition [[]] [[]] [[]]{}; // expected-error {{an attribute list cannot appear here}}
15    // CHECK: fix-it:{{.*}}:{14:4-14:4}
16    // CHECK: fix-it:{{.*}}:{14:37-14:51}
17 
18   class base {};
19   class [[]] [[]] final_class
20     alignas(float) [[]] final // expected-error {{an attribute list cannot appear here}}
21     alignas(float) [[]] [[]] alignas(float): base{}; // expected-error {{an attribute list cannot appear here}}
22     // CHECK: fix-it:{{.*}}:{19:19-19:19}
23     // CHECK: fix-it:{{.*}}:{20:5-20:25}
24     // CHECK: fix-it:{{.*}}:{19:19-19:19}
25     // CHECK: fix-it:{{.*}}:{21:5-21:44}
26 
27   class [[]] [[]] final_class_another
28     [[]] [[]] alignas(16) final // expected-error {{an attribute list cannot appear here}}
29     [[]] [[]] alignas(16) [[]]{}; // expected-error {{an attribute list cannot appear here}}
30     // CHECK: fix-it:{{.*}}:{27:19-27:19}
31     // CHECK: fix-it:{{.*}}:{28:5-28:27}
32     // CHECK: fix-it:{{.*}}:{27:19-27:19}
33     // CHECK: fix-it:{{.*}}:{29:5-29:31}
34 }
35 
36 namespace BaseSpecifier {
37   struct base1 {};
38   struct base2 {};
39   class with_base_spec : public [[a]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
40   // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}a]]"
41   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:""
42                          virtual [[b]] base1, // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
43   // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}b]]"
44   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:""
45                          virtual [[c]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
46   // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}c]]"
47   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:""
48                          public [[d]] base2 {}; // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
49   // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}d]]"
50   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:""
51 }
52