fixit-cxx11-attributes.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. namespace ClassSpecifier {
  7. class [[]] [[]]
  8. attr_after_class_name_decl [[]] [[]]; // expected-error {{an attribute list cannot appear here}}
  9. // CHECK: fix-it:{{.*}}:{9:5-9:5}
  10. // CHECK: fix-it:{{.*}}:{9:32-9:41}
  11. class [[]] [[]]
  12. attr_after_class_name_definition [[]] [[]] [[]]{}; // expected-error {{an attribute list cannot appear here}}
  13. // CHECK: fix-it:{{.*}}:{14:4-14:4}
  14. // CHECK: fix-it:{{.*}}:{14:37-14:51}
  15. class base {};
  16. class [[]] [[]] final_class
  17. alignas(float) [[]] final // expected-error {{an attribute list cannot appear here}}
  18. alignas(float) [[]] [[]] alignas(float): base{}; // expected-error {{an attribute list cannot appear here}}
  19. // CHECK: fix-it:{{.*}}:{19:19-19:19}
  20. // CHECK: fix-it:{{.*}}:{20:5-20:25}
  21. // CHECK: fix-it:{{.*}}:{19:19-19:19}
  22. // CHECK: fix-it:{{.*}}:{21:5-21:44}
  23. class [[]] [[]] final_class_another
  24. [[]] [[]] alignas(16) final // expected-error {{an attribute list cannot appear here}}
  25. [[]] [[]] alignas(16) [[]]{}; // expected-error {{an attribute list cannot appear here}}
  26. // CHECK: fix-it:{{.*}}:{27:19-27:19}
  27. // CHECK: fix-it:{{.*}}:{28:5-28:27}
  28. // CHECK: fix-it:{{.*}}:{27:19-27:19}
  29. // CHECK: fix-it:{{.*}}:{29:5-29:31}
  30. }
  31. namespace BaseSpecifier {
  32. struct base1 {};
  33. struct base2 {};
  34. class with_base_spec : public [[a]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
  35. // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}a]]"
  36. // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:""
  37. virtual [[b]] base1, // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
  38. // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}b]]"
  39. // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:""
  40. virtual [[c]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
  41. // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}c]]"
  42. // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:""
  43. public [[d]] base2 {}; // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
  44. // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}d]]"
  45. // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:""
  46. }