https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64696
Bug ID: 64696 Summary: [C++14] braced-init-list does not cause expected aggregate initialization Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hstong at ca dot ibm.com In the test case below, C++14 specifies that aggregate initialization is performed in subclause 8.5.4 [dcl.init.list] paragraph 3 for the braced-init- list containing "DESIGNATOR" in the source. Said aggregate initialization should leave the "x" member of the temporary with a value of 2. GCC does not appear to understand this to be the case since the static_assert should evaluate to false but no diagnostic appears. If the resolution of Core Issue 1467 is taken into account, then the case with of -std=gnu++1y -DDESIGNATED still behaves similarly. This result is rather surprising since the natural interpretation of that designated initializer is that it applies directly to the "a" member. ### SOURCE (<stdin>): struct A { const A &a; int x = 2; }; extern A a0; #if DESIGNATED # define DESIGNATOR .a = #else # define DESIGNATOR #endif constexpr int x = A{ DESIGNATOR A{ a0, 4 } }.x; static_assert(x != 2, "Expected diagnostic"); int main() { } ### COMPILER INVOCATION: g++ -Wall -Wextra -pedantic -std=c++1y -x c++ - ### COMPILER OUTPUT: No text; RC=0 ### EXPECTED OUTPUT: <stdin>:14:1: error: static assertion failed: Expected diagnostic ### VERSION INFO: Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/heads/gcc/gcc-source/configure --prefix=/usr/local/gcc-head --enable-languages=c,c++ --enable-lto --disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release --disable-nls Thread model: posix gcc version 5.0.0 20150120 (experimental) (GCC)