------- 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 <string>
     2  #include <typeinfo>
     3
     4  template<class FILTER, const std::string& filterName =
std::string("") >
     5  class Filter
     6  {
     7  public:
     8     virtual const std::string& getFilterName() const
     9     {
    10        static const std::string name = filterName;
    11        return name;
    12     }
    13  };
    14
    15  void breakMe()
    16  {
    17     Filter<int> boo;
    18  }
    19


-- 


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

Reply via email to