public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "d0sboots at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60184] New: g++ does not allow static members of named unions
Date: Thu, 13 Feb 2014 19:39:00 -0000 [thread overview]
Message-ID: <bug-60184-4@http.gcc.gnu.org/bugzilla/> (raw)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60184
Bug ID: 60184
Summary: g++ does not allow static members of named unions
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: d0sboots at gmail dot com
cat > test.cc <<EOF
union Test {
static constexpr int kConstant = 10;
};
EOF
g++ --std=c++0x -c -o test.o test.cc
produces:
test.cc:2:36: error: 'Test::kConstant' may not be static because it is a member
of a union
However, this is correct according to my reading of the standard, as well as
the folks here:
http://stackoverflow.com/questions/15996333/does-c11-allow-non-anonymous-unions-to-contain-static-data-members
It is also allowed by clang.
9/5 : "A union is a class defined with the class-key union; it holds only one
data member at a time"
Section 9.4, in general, describes static members. It places no restrictions on
static members in union-type classes.
9.5/1: "In a union, at most one of the non-static data members can be active at
any time, that is, the value of at most one of the non-static data members can
be stored in a union at any time."
There is no reason to specifically call out "non-static data members" unless
static data members can exist.
9.5/5: "The member-specification of an anonymous union shall only define
non-static data members."
This only applies to anonymous unions. That this is specifically called out for
anonymous unions implies that it *is* allowed in general.
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>From gcc-bugs-return-443505-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 13 21:15:50 2014
Return-Path: <gcc-bugs-return-443505-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20154 invoked by alias); 13 Feb 2014 21:15:50 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20100 invoked by uid 55); 13 Feb 2014 21:15:44 -0000
From: "tejohnson at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/43631] var-tracking inserts notes with non-NULL BLOCK_FOR_INSN in between basic blocks
Date: Thu, 13 Feb 2014 21:15:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.5.0
X-Bugzilla-Keywords: wrong-debug
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tejohnson at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: steven at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-43631-4-0x2hZjjTph@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-43631-4@http.gcc.gnu.org/bugzilla/>
References: <bug-43631-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg01262.txt.bz2
Content-length: 1680
http://gcc.gnu.org/bugzilla/show_bug.cgi?idC631
--- Comment #26 from tejohnson at gcc dot gnu.org ---
Author: tejohnson
Date: Thu Feb 13 21:15:06 2014
New Revision: 207766
URL: http://gcc.gnu.org/viewcvs?rev 7766&root=gcc&view=rev
Log:
2014-02-13 Teresa Johnson <tejohnson@google.com>
For Google b/12971524, backport r197994 to fix PR60141.
2013-04-16 Steven Bosscher <steven@gcc.gnu.org>
PR middle-end/43631
* emit-rtl.c (make_note_raw): New function.
(link_insn_into_chain): New static inline function.
(add_insn): Use it.
(add_insn_before, add_insn_after): Factor insn chain linking code...
(add_insn_before_nobb, add_insn_after_nobb): ...here, new functions
using link_insn_into_chain.
(note_outside_basic_block_p): New helper function for emit_note_after
and emit_note_before.
(emit_note_after): Use nobb variant of add_insn_after if the note
should not be contained in a basic block.
(emit_note_before): Use nobb variant of add_insn_before if the note
should not be contained in a basic block.
(emit_note_copy): Use make_note_raw.
(emit_note): Likewise.
* bb-reorder.c (insert_section_boundary_note): Remove hack to set
BLOCK_FOR_INSN to NULL manually for NOTE_INSN_SWITCH_TEXT_SECTIONS.
* jump.c (cleanup_barriers): Use reorder_insns_nobb to avoid making
the moved barrier the tail of the basic block it follows.
* var-tracking.c (pass_variable_tracking): Add TODO_verify_flow.
Modified:
branches/google/gcc-4_8/gcc/bb-reorder.c
branches/google/gcc-4_8/gcc/emit-rtl.c
branches/google/gcc-4_8/gcc/jump.c
branches/google/gcc-4_8/gcc/var-tracking.c
next reply other threads:[~2014-02-13 19:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 19:39 d0sboots at gmail dot com [this message]
2014-06-06 10:10 ` [Bug c++/60184] " paolo.carlini at oracle dot com
2014-06-06 16:02 ` paolo.carlini at oracle dot com
2014-06-06 16:02 ` paolo at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-60184-4@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).