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

            Bug ID: 66256
           Summary: noexcept evaluation done before end of class
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qigopsrtv at gmail dot com
  Target Milestone: ---

The following code does not compile (with -std=c++11):

struct test
{
        // it only works if e is declared before test()
        test() noexcept(e) {}
        static const bool e = false;
};

int main() {}

It gives me "error:'e' was not declared in this scope", while 'e' should be
visible, even though it is declared after test().
It is my understanding of the standard that the expression evaluation inside
noexcept should be done once all class members are parsed (cf. 9.2/2 of n3337).

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5-20150519/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --disable-multilib --disable-werror
--enable-checking=release --with-default-libstdcxx-abi=c++98
Thread model: posix
gcc version 5.1.0 (GCC)

Reply via email to