Hi,
Does clang support attributes on templates? My understanding is their design is based on GCC attributes and the GCC documentation doesn’t specify template support:
http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
This also excludes support for namespace attributes. When I try to use attributes on namespaces, I get the following:
attribute((annotate(“attr”))) namespace core {
error: expected unqualified-id
namespace attribute((annotate(“attr”))) core {
error: expected identifier or ‘{’
namespace core attribute((annotate(“attr”))) {
Compiles fine!
However, when I inspect the attributes using clang::Decl::attr_begin, there are no attributes there.
I’m having the same issue with templates:
attribute((annotate(“attr”))) template struct Vector {
error: expected unqualified-id
template attribute((annotate(“attr”))) struct Vector {
Compiles fine!
template struct attribute((annotate(“attr”))) Vector {
Compiles fine!
template struct Vector attribute((annotate(“attr”))) {
: error: expected unqualified-id
In all the cases where it compiles fine for the template case above, there are no attributes in the AST.
Am I using the wrong means of getting the attribute list? It works for classes, fields, functions and enumerations so far.
Thanks,
- Don