https://bugs.llvm.org/show_bug.cgi?id=41016
Bug ID: 41016
Summary: Warn when __atribute__((used)) is on definitions
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
The following code generates the following suboptimal error with top-of-tree
clang:
```
template <typename T>
class Foo {
void bar() __attribute__((used));
};
using FooInt = Foo<int>;
static FooInt f;
template <>
void FooInt::bar() { }
```
Generates:
```
/tmp/xxx.cpp:11:14: error: explicit specialization of 'bar' after instantiation
void FooInt::bar() { }
^
/tmp/xxx.cpp:8:15: note: implicit instantiation first required here
static FooInt f;
^
1 error generated.
```
Whereas the real underlying problem is that `__attribute__((used))` is on the
definition, not the declaration.
Please consider having a direct warning about the misplaced attribute. Thanks!
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs