public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11077] New: enumerator value in template not assignable from bool
@ 2003-06-03 10:23 numerical.simulation@web.de
2003-06-03 12:36 ` [Bug c++/11077] " pinskia@physics.uc.edu
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: numerical.simulation@web.de @ 2003-06-03 10:23 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11077
Summary: enumerator value in template not assignable from bool
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: blocker
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: numerical.simulation@web.de
CC: gcc-bugs@gcc.gnu.org,numerical.simulation@web.de
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
The following code does not compile with gcc, though it is valid C++ (IMHO)
#include <iostream>
template<class T>
class has_member_disambiguation // Thanks to Paul Mensonides
{
protected:
template<class U> static char check(typename U::Disambiguation*);
template<class U> static char (& check(...))[2];
public:
enum { value = (sizeof(check<T>(0)) == 1) };
};
struct A
{
typedef double Disambiguation;
};
struct B {};
int main()
{
std::cerr << has_member_disambiguation<A>::value << std::endl;
std::cerr << has_member_disambiguation<B>::value << std::endl;
}
g++ ~/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C: In instantiation of
`has_member_disambiguation<A>':
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:24: instantiated from
here
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:11: error: invalid use of
undefined type `class has_member_disambiguation<A>'
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:5: error: declaration of `
class has_member_disambiguation<A>'
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:11: error: enumerator
value for `value' not integer constant
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C: In instantiation of
`has_member_disambiguation<B>':
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:25: instantiated from
here
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:11: error: invalid use of
undefined type `class has_member_disambiguation<B>'
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:5: error: declaration of `
class has_member_disambiguation<B>'
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:11: error: enumerator
value for `value' not integer constant
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/11077] enumerator value in template not assignable from bool
2003-06-03 10:23 [Bug c++/11077] New: enumerator value in template not assignable from bool numerical.simulation@web.de
@ 2003-06-03 12:36 ` pinskia@physics.uc.edu
2003-06-03 12:42 ` reichelt@gcc.gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-03 12:36 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11077
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|blocker |major
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-06-03 12:36:39
date| |
------- Additional Comments From pinskia@physics.uc.edu 2003-06-03 12:36 -------
I am going to assume this is valid C++
It happens on 2.95.3, 3.0.4, 3.2.3, 3.3.1 (20030526) and the mainline (20030602).
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/11077] enumerator value in template not assignable from bool
2003-06-03 10:23 [Bug c++/11077] New: enumerator value in template not assignable from bool numerical.simulation@web.de
2003-06-03 12:36 ` [Bug c++/11077] " pinskia@physics.uc.edu
@ 2003-06-03 12:42 ` reichelt@gcc.gnu.org
2003-06-03 13:14 ` numerical.simulation@web.de
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: reichelt@gcc.gnu.org @ 2003-06-03 12:42 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11077
reichelt@gcc.gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
------- Additional Comments From reichelt@gcc.gnu.org 2003-06-03 12:42 -------
This is essentially the same problem as in PR 9259.
Even Giovanni's workaround is applicable here: Write
sizeof(has_member_disambiguation::template check<T>(0))
instead of
sizeof(check<T>(0))
*** This bug has been marked as a duplicate of 9259 ***
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/11077] enumerator value in template not assignable from bool
2003-06-03 10:23 [Bug c++/11077] New: enumerator value in template not assignable from bool numerical.simulation@web.de
2003-06-03 12:36 ` [Bug c++/11077] " pinskia@physics.uc.edu
2003-06-03 12:42 ` reichelt@gcc.gnu.org
@ 2003-06-03 13:14 ` numerical.simulation@web.de
2003-06-03 13:23 ` pinskia@physics.uc.edu
2003-06-03 17:13 ` giovannibajo@libero.it
4 siblings, 0 replies; 6+ messages in thread
From: numerical.simulation@web.de @ 2003-06-03 13:14 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11077
------- Additional Comments From numerical.simulation@web.de 2003-06-03 13:14 -------
Subject: Re: enumerator value in template not assignable from
bool
"reichelt@gcc.gnu.org" wrote:
> This is essentially the same problem as in PR 9259.
> Even Giovanni's workaround is applicable here: Write
>
> sizeof(has_member_disambiguation::template check<T>(0))
>
> instead of
>
> sizeof(check<T>(0))
Nope, with the workaround You get an ICE:
[...]
enum { value = (sizeof(has_member_disambiguation::template check<T>(0)) == 1) };
[...]
g++ ~/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C: In instantiation of `has_member_disambiguation<A>':
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:24: instantiated from here
/home/markus/hp-home/C++/EXPERIMENTAL/GCC-3.4-Bugs.C:11: internal compiler error: Segmentation
fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/softwa
Markus
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/11077] enumerator value in template not assignable from bool
2003-06-03 10:23 [Bug c++/11077] New: enumerator value in template not assignable from bool numerical.simulation@web.de
` (2 preceding siblings ...)
2003-06-03 13:14 ` numerical.simulation@web.de
@ 2003-06-03 13:23 ` pinskia@physics.uc.edu
2003-06-03 17:13 ` giovannibajo@libero.it
4 siblings, 0 replies; 6+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-03 13:23 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11077
------- Additional Comments From pinskia@physics.uc.edu 2003-06-03 13:23 -------
Actually with the workaround I do not get an ICE but on 3.3.1 (20030526) the code is accepted but
on the mainline (20030603) it is rejected:
tin:~/src/gnu/gcctest>~/ia32_linux_gcc3_3/bin/gcc pr11077.cc -c
tin:~/src/gnu/gcctest>gcc pr11077.cc -c
pr11077.cc:13: error: expected primary-expression
pr11077.cc: In instantiation of `has_member_disambiguation<A>':
pr11077.cc:26: instantiated from here
pr11077.cc:13: error: enumerator value for `value' not integer constant
pr11077.cc: In instantiation of `has_member_disambiguation<B>':
pr11077.cc:27: instantiated from here
pr11077.cc:13: error: enumerator value for `value' not integer constant
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/11077] enumerator value in template not assignable from bool
2003-06-03 10:23 [Bug c++/11077] New: enumerator value in template not assignable from bool numerical.simulation@web.de
` (3 preceding siblings ...)
2003-06-03 13:23 ` pinskia@physics.uc.edu
@ 2003-06-03 17:13 ` giovannibajo@libero.it
4 siblings, 0 replies; 6+ messages in thread
From: giovannibajo@libero.it @ 2003-06-03 17:13 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11077
------- Additional Comments From giovannibajo@libero.it 2003-06-03 17:13 -------
The failure Andrew reported on the mainline (sizeof treated as non-constant) is
already covered by c++/9907. I'm sure there is at least a syntax of
has_member_xxxx that works with GCC 3.4, but I can't find it in my notes. I
suggest the poster to try tweaking the sample a bit.
Since there are no new failures in this bug, it's ok to keep it closed as a
duplicate.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-06-03 17:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-03 10:23 [Bug c++/11077] New: enumerator value in template not assignable from bool numerical.simulation@web.de
2003-06-03 12:36 ` [Bug c++/11077] " pinskia@physics.uc.edu
2003-06-03 12:42 ` reichelt@gcc.gnu.org
2003-06-03 13:14 ` numerical.simulation@web.de
2003-06-03 13:23 ` pinskia@physics.uc.edu
2003-06-03 17:13 ` giovannibajo@libero.it
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).