[Bug c++/39444] ICE caused by default template argument

2009-04-16 Thread pinskia at gcc dot gnu dot org


--- Comment #5 from pinskia at gcc dot gnu dot org  2009-04-16 20:50 ---
The trunk gives:
t.cc:18: error: a cast to a type other than an integral or enumeration type
cannot appear in a constant-expression
t.cc:18: error: template argument 2 is invalid
t.cc:18: error: invalid type in declaration before ‘;’ token

So does 4.4.0
So closing as fixed for 4.4.0


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
   Keywords||ice-on-invalid-code
 Resolution||FIXED
   Target Milestone|--- |4.4.0


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



[Bug c++/39444] ICE caused by default template argument

2009-03-17 Thread dodji at redhat dot com


--- Comment #4 from dodji at gcc dot gnu dot org  2009-03-17 22:10 ---
Subject: Re:   New: ICE caused by default template argument

FWIW, on gcc 4.3.2, I get the error:

test.cc: In function 'void breakMe()':
test.cc:17: error: a cast to a type other than an integral or
enumeration type cannot appear in a constant-expression
test.cc:17: error: template argument 2 is invalid
test.cc:17: error: invalid type in declaration before ';' token

The source listing annotated with line numbers is:
   1  #include 
 2  #include 
 3
 4  template
 5  class Filter
 6  {
 7  public:
 8 virtual const std::string& getFilterName() const
 9 {
10static const std::string name = filterName;
11return name;
12 }
13  };
14
15  void breakMe()
16  {
17 Filter boo;
18  }
19


-- 


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



[Bug c++/39444] ICE caused by default template argument

2009-03-12 Thread tortoise_74 at yahoo dot co dot uk


--- Comment #3 from tortoise_74 at yahoo dot co dot uk  2009-03-12 18:34 
---
I should point out (as it is not obvious to the uninitiated) that this may not
be legal C++ as "A string literal cannot be used as a template argument". 
String literals have internal linkage. So string arguments can only be used if
they are declared extern.

The bug might be that gcc is not outputting this message but instead an ICE or
something about the ABI.

However, a std::string is not the same as a char* so a language lawyer might be
needed here. The bugs manifest as if the two are identical. 


-- 


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



[Bug c++/39444] ICE caused by default template argument

2009-03-12 Thread tortoise_74 at yahoo dot co dot uk


--- Comment #2 from tortoise_74 at yahoo dot co dot uk  2009-03-12 17:23 
---
Created an attachment (id=17450)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17450&action=view)
"defect in the C++ ABI" message


-- 


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



[Bug c++/39444] ICE caused by default template argument

2009-03-12 Thread tortoise_74 at yahoo dot co dot uk


--- Comment #1 from tortoise_74 at yahoo dot co dot uk  2009-03-12 17:21 
---
Created an attachment (id=17449)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17449&action=view)
ICE with arg = std::string("")


-- 


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