[Bug c++/18161] New: [4.0 regression] typeof(1==1) is now int instead of bool
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Tue Oct 26 13:30:00 GMT 2004
For this code
-----------------
template <typename = typeof(1==1)> struct X { X(){} };
template struct X<>;
-----------------
I would expect an instantiation of X<bool>, and indeed got it up to
3.4. However, since 4.0 we get X<int>:
g/x> /home/bangerth/bin/gcc-3.4*/bin/c++ -c x.cc ; nm -C x.o
00000000 W X<bool>::X()
00000000 W X<bool>::X()
g/x> /home/bangerth/bin/gcc-4*/bin/c++ -c x.cc ; nm -C x.o
00000000 W X<int>::X()
00000000 W X<int>::X()
This is somehow odd, since for a related piece of code
-------------------
template <typename> struct X {};
void foo(X<typeof(1==1)>) {}
-------------------
there is no regression:
g/x> /home/bangerth/bin/gcc-3.4*/bin/c++ -c y.cc ; nm -C y.o
00000000 T foo(X<bool>)
g/x> /home/bangerth/bin/gcc-4*/bin/c++ -c y.cc ; nm -C y.o
00000000 T foo(X<bool>)
W.
--
Summary: [4.0 regression] typeof(1==1) is now int instead of bool
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18161
More information about the Gcc-bugs
mailing list