[llvm-bugs] [Bug 48111] New: Clang mistakes gnu::nothrow attribute for noexcept(true)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 8 15:44:07 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48111

            Bug ID: 48111
           Summary: Clang mistakes gnu::nothrow attribute for
                    noexcept(true)
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: compile-fail
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Clang seems to treat [[gnu::nothrow]] like `noexcept(true)` even in the type
system. GCC does not do so, and the distinction seems to be reasonable.

Compiler Explorer link: https://godbolt.org/z/heGWWb


### SOURCE (<stdin>):
void f [[gnu::nothrow]]();
template <typename> struct A;
template <> struct A<void ()> {};
A<decltype(f)> a;


### COMPILER INVOCATION:
clang -cc1 -fsyntax-only -xc++ -std=c++17 -


### EXPECTED OUTPUT:
(clean compile)


### ACTUAL OUTPUT:
<stdin>:4:16: error: implicit instantiation of undefined template 'A<void ()
noexcept>'
A<decltype(f)> a;
               ^
<stdin>:2:28: note: template is declared here
template <typename> struct A;
                           ^
1 error generated.


### COMPILER VERSION INFO (clang++ -v):
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
1c19900f9417bd0b832c1cb70863b2439a18647f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

-- 
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/20201108/0f39ecd0/attachment.html>


More information about the llvm-bugs mailing list