GNU-style type attributes are not allowed in new expressions, such as: auto *P = new int * __attribute__((attr));
We silently accept them in clang, but have a FIXME in the code to
address the issue. This patch is an initial stab at addressing the
issue, and I am looking for feedback on whether my approach is
reasonable or not. (It disables support for GNU attributes, but not
other vendor attributes which should remain supported.)
Note, the attached test case does not currently pass. It only checks
for one error diagnostic, but the actual diagnostics for that code
are:
..\llvm\tools\clang\test\SemaCXX\attr-gnu.cpp:4:22: error: an
attribute list cannot appear here
auto P = new int * __attribute__((vector_size(8))); // expected-error ...
^
..\llvm\tools\clang\test\SemaCXX\attr-gnu.cpp:4:21: error: expected
';' at end of declaration
auto P = new int * __attribute__((vector_size(8))); // expected-error ...
^
;
..\llvm\tools\clang\test\SemaCXX\attr-gnu.cpp:4:22: warning:
declaration does not declare anything [-Wmissing-declarations]
auto P = new int * __attribute__((vector_size(8))); // expected-error ...
^~~~~~~~~~~~~
1 warning and 2 errors generated.
The first diagnostic is obviously correct, but are the other two
reasonable diagnostics as well?
If the approach is reasonable, I'll clean the patch up, add more test
cases, etc. I mostly wanted to check my direction first. Thanks!
~Aaron
TypeAttr.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
