This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/85940] New: Address of label breaks ISO C++ program despite non-GNU dialect and pedantic


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

            Bug ID: 85940
           Summary: Address of label breaks ISO C++ program despite
                    non-GNU dialect and pedantic
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

The address of label extension breaks well-formed C++ programs.
GCC confuses the logical AND operator for the extension in the source below.
MSVC works.

### SOURCE (<stdin>):
bool f(bool x) {
x:
  return (bool()) && x;
}


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


### ACTUAL OUTPUT:
<stdin>: In function 'bool f(bool)':
<stdin>:3:22: warning: taking the address of a label is non-standard
[-Wpedantic]
<stdin>:3:22: error: invalid cast to function type 'bool()'


### EXPECTED OUTPUT:
(Clean compile).


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]