[llvm-bugs] [Bug 41016] New: Warn when __atribute__((used)) is on definitions
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Mar 8 11:03:02 PST 2019
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: unassignedclangbugs at nondot.org
Reporter: dave at znu.io
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190308/69f010fb/attachment-0001.html>
More information about the llvm-bugs
mailing list