https://bugs.llvm.org/show_bug.cgi?id=40704
Bug ID: 40704
Summary: Attributes accepted with linkage spec declarations
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: aa...@aaronballman.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
Clang currently accepts all kinds of attributes before a linkage specification
declaration. e.g. (with -fdeclspec and GNU extensions enabled),
__attribute__(()) extern "C" void bar();
__declspec() extern "C" void baz();
[[]] extern "C" void foo();
__attribute__(()) extern "C" { void quux(); }
__declspec() extern "C" { void meow(); }
[[]] extern "C" { void woof(); }
GCC does not accept GNU-style attributes in that position, C++ does not allow
C++-style attributes in that position, but Microsoft *does* allow __declspec
attributes in that position.
We parse attributes before we determine we're parsing a linkage specification
because it makes the design of the parser easier. Unfortunately, the
declaration specifiers parsing construct does not track a
ParsedAttributesWithRange for the attributes, so there is not an easy way to
determine whether the declaration specifiers have attributes applied to them or
not. For instance, the empty attribute lists above are problematic because the
DS does not think there are any attributes applied to it. Further, we do not
track disjoint ranges of attributes particularly well, so declarations like
this could be tricky to diagnose:
__attribute__(()) __declspec() [[]] extern "C" void foo();
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs