summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx0x-attributes.cpp
diff options
context:
space:
mode:
authorFaisal Vali <faisalv@yahoo.com>2017-12-25 22:23:20 +0000
committerFaisal Vali <faisalv@yahoo.com>2017-12-25 22:23:20 +0000
commitc5089c08d4cd4e8b36034c1fdae056e3f5f239ab (patch)
tree61c4b4df854c9950257ef4a043c9e7840ea130b5 /clang/test/Parser/cxx0x-attributes.cpp
parent99bbb213b50142d792e59996c56886c1b1e06118 (diff)
downloadbcm5719-llvm-c5089c08d4cd4e8b36034c1fdae056e3f5f239ab.tar.gz
bcm5719-llvm-c5089c08d4cd4e8b36034c1fdae056e3f5f239ab.zip
Add a fixit for attributes incorrectly placed prior to 'struct/class/enum' keyword.
Suggest moving the following erroneous attrib list (based on location) [[]] struct X; to struct [[]] X; Additionally, added a fixme for the current implementation that diagnoses misplaced attributes to consider using the newly introduced diagnostic (that I think is more user-friendly). llvm-svn: 321449
Diffstat (limited to 'clang/test/Parser/cxx0x-attributes.cpp')
-rw-r--r--clang/test/Parser/cxx0x-attributes.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/test/Parser/cxx0x-attributes.cpp b/clang/test/Parser/cxx0x-attributes.cpp
index 4e3a2e4685e..e01491db413 100644
--- a/clang/test/Parser/cxx0x-attributes.cpp
+++ b/clang/test/Parser/cxx0x-attributes.cpp
@@ -64,6 +64,13 @@ struct MemberFnOrder {
struct [[]] struct_attr;
class [[]] class_attr {};
union [[]] union_attr;
+enum [[]] E { };
+namespace test_misplacement {
+[[]] struct struct_attr2; //expected-error{{misplaced attributes}}
+[[]] class class_attr2; //expected-error{{misplaced attributes}}
+[[]] union union_attr2; //expected-error{{misplaced attributes}}
+[[]] enum E2 { }; //expected-error{{misplaced attributes}}
+}
// Checks attributes placed at wrong syntactic locations of class specifiers.
class [[]] [[]]
@@ -91,7 +98,7 @@ class C final [[deprecated(l]] {}); // expected-error {{use of undeclared identi
class D final alignas ([l) {}]{}); // expected-error {{expected ',' or ']' in lambda capture list}} expected-error {{an attribute list cannot appear here}}
[[]] struct with_init_declarators {} init_declarator;
-[[]] struct no_init_declarators; // expected-error {{an attribute list cannot appear here}}
+[[]] struct no_init_declarators; // expected-error {{misplaced attributes}}
template<typename> [[]] struct no_init_declarators_template; // expected-error {{an attribute list cannot appear here}}
void fn_with_structs() {
[[]] struct with_init_declarators {} init_declarator;
OpenPOWER on IntegriCloud