public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21510] New: Possible bug
@ 2005-05-11 10:28 sven at clio dot in-berlin dot de
  2005-05-11 11:10 ` [Bug c++/21510] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: sven at clio dot in-berlin dot de @ 2005-05-11 10:28 UTC (permalink / raw)
  To: gcc-bugs

The following code contains a test template is_class which tries to determine, 
if the given argument is a class. Unlike other implementations it should not 
return true if the argument is a union. I have used the 'substitution failure 
is not an error' principle but g++ V3.3.5 (Debian 1:3.3.5-12) (i486-linux) 
fails with an error though it has a default function available. Since I do not 
have the standard I can't declare this a bug. 
 
---- bug.c 
 
cusing namespace std; 
 
#include <iostream> 
 
template<typename _T> 
struct is_class 
{ 
  typedef char no; 
  struct yes { char c[2]; }; 
  template<typename _U> 
  struct c: _U 
  { 
    c(int); 
  }; 
 
  template<typename _U> static no test (...); 
  template<typename _U> static yes test(c<_U>); 
 
  static const bool v = (sizeof (test<_T>(0))==sizeof(yes)); 
}; 
 
union u { int i; double f; }; 
struct c {}; 
 
int main (void) 
{ 
  cout << "union:" << is_class<u>::v << endl; 
  cout << "class:" << is_class<c>::v << endl; 
  cout << "int:" << is_class<int>::v << endl; 
 
  return 0; 
};

-- 
           Summary: Possible bug
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sven at clio dot in-berlin dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21510


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

end of thread, other threads:[~2005-05-17 11:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-11 10:28 [Bug c++/21510] New: Possible bug sven at clio dot in-berlin dot de
2005-05-11 11:10 ` [Bug c++/21510] " pinskia at gcc dot gnu dot org
2005-05-12  9:49 ` sven at clio dot in-berlin dot de
2005-05-15 12:37 ` lerdsuwa at gcc dot gnu dot org
2005-05-15 14:08 ` sven at clio dot in-berlin dot de
2005-05-15 14:13 ` pinskia at gcc dot gnu dot org
2005-05-15 14:46 ` sven at clio dot in-berlin dot de
2005-05-15 15:04 ` pcarlini at suse dot de
2005-05-16 10:22 ` sven at clio dot in-berlin dot de
2005-05-16 19:19 ` gdr at integrable-solutions dot net
2005-05-17 11:43 ` sven at clio dot in-berlin dot de

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).