Issue |
131700
|
Summary |
Overly pedantic [[noreturn]] restriction
|
Labels |
new issue
|
Assignees |
|
Reporter |
kimbarrett
|
C++11 says that the first declaration of a function must specify the `[[noreturn]]` attribute if any declaration specifies it.
All of gcc, clang, and MSVC provide compiler-specific mechanisms to indicate a function is "noreturn". gcc and clang have `attribute((noreturn))`, while MSVC has `__declspec(noreturn)`. gcc and MSVC treat their compiler-specific attributes as satisfying the first declaration attribute requirement, but clang does not. That is, this compiles cleanly with gcc, but clang issues a warning
```
attribute((noreturn)) void testfn(int);
[[noreturn]] void testfn(int);
```
and this compiles cleanly with MSVC, but clang issues a warning
```
__declspec(noreturn) void testfn(int);
[[noreturn]] void testfn(int);
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs