public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable
@ 2013-02-25 23:41 d.frey at gmx dot de
2013-02-26 7:36 ` [Bug c++/56450] " jakub at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: d.frey at gmx dot de @ 2013-02-25 23:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56450
Bug #: 56450
Summary: ICE with SFINAE when detecting non-static member
variable
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: d.frey@gmx.de
I tried to detect a non-static member variable of a given type and ran into an
ICE. Here's the code:
#include <type_traits>
template< typename, typename = void >
struct has_const_int_dummy
: std::false_type
{};
template< typename T >
struct has_const_int_dummy< T, typename std::enable_if< std::is_same< decltype(
std::declval< T >().dummy ), const int >::value >::type >
: std::true_type
{};
struct A0 { const int dummy; };
struct A1 {};
struct A2 { int dummy(); };
struct A3 { static const int dummy = 0; };
int main()
{
static_assert( has_const_int_dummy< A0 >::value, "A0" );
static_assert( !has_const_int_dummy< A1 >::value, "A1" );
static_assert( !has_const_int_dummy< A2 >::value, "A2" );
static_assert( !has_const_int_dummy< A3 >::value, "A3" ); // line 23
}
And here's the output from by shell:
frey@vbox$ clang++-3.2 -std=c++0x -O3 -Wall -Wextra t.cc -o t
frey@vbox$ g++-4.7 -std=c++0x -O3 -Wall -Wextra t.cc -o t
t.cc: In function ‘int main()’:
t.cc:23:44: internal compiler error: in finish_decltype_type, at
cp/semantics.c:5274
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cclJIlZs.out file, please attach this to
your bugreport.
frey@vbox$
As you can see, the code is accepted by clang. Also, the same error as with
g++-4.7 is also produced by g++-4.6, just the line number in cp/semantics.c is
different.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56450] ICE with SFINAE when detecting non-static member variable
2013-02-25 23:41 [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable d.frey at gmx dot de
@ 2013-02-26 7:36 ` jakub at gcc dot gnu.org
2013-04-26 15:16 ` paolo.carlini at oracle dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-26 7:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56450
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-26 07:36:33 UTC ---
I think the problem is that originally decltype is used on something that looks
like member access (COMPONENT_REF with IDENTIFIER_NODE as second operand), so
DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P is set on it, but then, as during
instantiation it is determined to be a static data member rather than member,
it is changed into COMPOUND_EXPR which first evaluates the former operand of
the COMPOUND_EXPR for side-effects and then has the VAR_DECL of the static data
member. But for id_expression_or_member_access_p = true finish_decltype_type
doesn't handle COMPOUND_EXPR.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56450] ICE with SFINAE when detecting non-static member variable
2013-02-25 23:41 [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable d.frey at gmx dot de
2013-02-26 7:36 ` [Bug c++/56450] " jakub at gcc dot gnu.org
@ 2013-04-26 15:16 ` paolo.carlini at oracle dot com
2013-04-28 22:58 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-26 15:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56450
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gessos.paul at yahoo dot gr
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-26 15:16:51 UTC ---
*** Bug 56949 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56450] ICE with SFINAE when detecting non-static member variable
2013-02-25 23:41 [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable d.frey at gmx dot de
2013-02-26 7:36 ` [Bug c++/56450] " jakub at gcc dot gnu.org
2013-04-26 15:16 ` paolo.carlini at oracle dot com
@ 2013-04-28 22:58 ` paolo.carlini at oracle dot com
2013-04-29 14:03 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-28 22:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56450
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.9.0
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-28 22:58:13 UTC ---
Fixed for 4.9.0.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56450] ICE with SFINAE when detecting non-static member variable
2013-02-25 23:41 [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable d.frey at gmx dot de
` (2 preceding siblings ...)
2013-04-28 22:58 ` paolo.carlini at oracle dot com
@ 2013-04-29 14:03 ` jason at gcc dot gnu.org
2013-04-29 14:08 ` paolo.carlini at oracle dot com
2013-04-29 14:26 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2013-04-29 14:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56450
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2013-04-29 14:03:25 UTC ---
Let's put this into 4.8.1 as well; it's completely safe.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56450] ICE with SFINAE when detecting non-static member variable
2013-02-25 23:41 [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable d.frey at gmx dot de
` (3 preceding siblings ...)
2013-04-29 14:03 ` jason at gcc dot gnu.org
@ 2013-04-29 14:08 ` paolo.carlini at oracle dot com
2013-04-29 14:26 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-29 14:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56450
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-29 14:08:28 UTC ---
Ok.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56450] ICE with SFINAE when detecting non-static member variable
2013-02-25 23:41 [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable d.frey at gmx dot de
` (4 preceding siblings ...)
2013-04-29 14:08 ` paolo.carlini at oracle dot com
@ 2013-04-29 14:26 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-29 14:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56450
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.9.0 |4.8.1
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-04-29 14:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25 23:41 [Bug c++/56450] New: ICE with SFINAE when detecting non-static member variable d.frey at gmx dot de
2013-02-26 7:36 ` [Bug c++/56450] " jakub at gcc dot gnu.org
2013-04-26 15:16 ` paolo.carlini at oracle dot com
2013-04-28 22:58 ` paolo.carlini at oracle dot com
2013-04-29 14:03 ` jason at gcc dot gnu.org
2013-04-29 14:08 ` paolo.carlini at oracle dot com
2013-04-29 14:26 ` paolo.carlini at oracle dot com
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).