https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92052

            Bug ID: 92052
           Summary: No message for adding the noreturn attribute only
                    after the first declaration
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

Given the following:
void f(void), f [[noreturn]](void);

GCC does not produce any message (even with -std=c++11 -pedantic -Wall -Wextra)
with respect to C++11 subclause 7.6.3 [dcl.attr.noreturn] paragraph 1:

The first declaration of a function shall specify the `noreturn` attribute if
any declaration of that function specifies the `noreturn` attribute.

### COMPILER INVOCATION COMMAND:
g++ -fsyntax-only -std=c++11 -pedantic -Wall -Wextra -xc++ -


### ACTUAL OUTPUT:
(No messages; rc=0).


### EXPECTED OUTPUT:
(Warning or error).


### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-9.2.0/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-9.2.0/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-9.2.0/configure --prefix=/opt/wandbox/gcc-9.2.0
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-9.2.0/lib,-rpath,/opt/wandbox/gcc-9.2.0/lib64,-rpath,/opt/wandbox/gcc-9.2.0/lib32
--enable-lto
Thread model: posix
gcc version 9.2.0 (GCC)

Reply via email to