public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64696] New: [C++14] braced-init-list does not cause expected aggregate initialization
@ 2015-01-20 18:38 hstong at ca dot ibm.com
2021-07-28 5:06 ` [Bug c++/64696] [C++14] braced-init-list does not respect designated initializer pinskia at gcc dot gnu.org
2024-03-12 7:09 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: hstong at ca dot ibm.com @ 2015-01-20 18:38 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/64696] [C++14] braced-init-list does not respect designated initializer
2015-01-20 18:38 [Bug c++/64696] New: [C++14] braced-init-list does not cause expected aggregate initialization hstong at ca dot ibm.com
@ 2021-07-28 5:06 ` pinskia at gcc dot gnu.org
2024-03-12 7:09 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-28 5:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64696
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid, wrong-code
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #1)
> G++ implements issue 1467, so the only bug is with the designated
> initializer, which is an extension for C compatibility.
Well not exactly an extension only more :). It was added for C++20.
Anyways this seems fixed on the trunk.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/64696] [C++14] braced-init-list does not respect designated initializer
2015-01-20 18:38 [Bug c++/64696] New: [C++14] braced-init-list does not cause expected aggregate initialization hstong at ca dot ibm.com
2021-07-28 5:06 ` [Bug c++/64696] [C++14] braced-init-list does not respect designated initializer pinskia at gcc dot gnu.org
@ 2024-03-12 7:09 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-12 7:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64696
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-12 7:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20 18:38 [Bug c++/64696] New: [C++14] braced-init-list does not cause expected aggregate initialization hstong at ca dot ibm.com
2021-07-28 5:06 ` [Bug c++/64696] [C++14] braced-init-list does not respect designated initializer pinskia at gcc dot gnu.org
2024-03-12 7:09 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).