Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp0x/pr79118.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line source
// { dg-do compile { target c++11 } } // { dg-additional-options { -Wno-pedantic } } // PR c++/79118 failure to check initialization of anonymous members. struct One { union { int a; int b; }; constexpr One () : a(), b() {} // { dg-error "multiple" } constexpr One (int) : a() {} constexpr One (unsigned) : b () {} constexpr One (void *) {} // { dg-error "exactly one" } }; One a (); One b (0); One c (0u); One d ((void *)0); struct Two { struct { int a; int b; }; constexpr Two () : a(), b() {} constexpr Two (int) : a() {} // { dg-error "b' must be initialized" } constexpr Two (unsigned) : b () {} // { dg-error "a' must be initialized" } constexpr Two (void *) {} // { dg-error "a' must be initialized" } // { dg-error "b' must be initialized" "" { target *-*-* } .-1 } }; Two e (); Two f (0); Two g (0u); Two h ((void *)0);