g++-980205: Template instantiation with constant c-strings

Dirk Herrmann dirk@ida.ing.tu-bs.de
Wed Feb 11 07:16:00 GMT 1998


Hello everybody, special hello to Mark!


The following code won't get compiled by egcs:



class X
{
  public:
    template <class T1>
    void f(const T1&) { }
};

main()
{
    X x;
    x.f("hallo");
}




> g++ test.cc
test.cc: In function `int main()':
test.cc:11: no matching function for call to `X::f (char[6])'
test.cc:5: candidates are: X::f<char[6]>(const char (&)[6])


In cases, where f is not a member template function, but an ordinary
template function, everything works fine.


Best regards, 
Dirk Herrmann




More information about the Gcc-bugs mailing list