public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18161] New: [4.0 regression] typeof(1==1) is now int instead of bool
@ 2004-10-26 13:30 bangerth at dealii dot org
  2004-10-26 13:31 ` [Bug c++/18161] [4.0 regression] typeof(1==1) is now int instead of bool in template default arguments bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-10-26 13:30 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-27  4:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-26 13:30 [Bug c++/18161] New: [4.0 regression] typeof(1==1) is now int instead of bool bangerth at dealii dot org
2004-10-26 13:31 ` [Bug c++/18161] [4.0 regression] typeof(1==1) is now int instead of bool in template default arguments bangerth at dealii dot org
2004-10-26 13:34 ` pinskia at gcc dot gnu dot org
2004-10-26 13:36 ` pinskia at gcc dot gnu dot org
2004-10-26 21:58 ` mmitchel at gcc dot gnu dot org
2004-10-27  2:23 ` cvs-commit at gcc dot gnu dot org
2004-10-27  4:23 ` mmitchel at gcc dot gnu dot 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).