g++ 1.1b : template problem with enum
Alexandre Oliva
oliva@dcc.unicamp.br
Fri Nov 27 01:03:00 GMT 1998
On Oct 15, 1998, "Isabelle Dauthieu p.36 236" <dauthieu@onera.fr> wrote:
> test.cc:29: prototype for `::test::Temp<T>::Bug::Bug(const T &, enum
> ::test::Temp<T>::State &)' does not match any in class `::test::Temp<T>::Bug'
> test.cc:16: candidate is: ::test::Temp<T>::Bug::Bug(const T &, const enum
> ::test::Temp<T>::State &)
> test.cc: In method `::test::Temp<T>::Bug::Bug(const T &, enum
> ::test::Temp<T>::State &)':
> test.cc:29: template definition of non-template `::test::Temp<T>::Bug::Bug(const
> T &, enum ::test::Temp<T>::State &)'
> test.cc: In function `int main(int, char **)':
> test.cc:42: warning: unused variable `class ::test::::test::Temp<int> temp'
> test.cc: In method `::test::::test::Temp<int>::Temp<int>(const int &)':
> test.cc:37: instantiated from here
> test.cc:33: warning: initialization of non-const reference `enum
> ::test::::test::Temp<int>::State &' from rvalue
> `::test::::test::Temp<int>::State'
> test.cc:16: warning: in passing argument 2 of `Temp<int>::Bug::Bug<int>(const
> int &, ::test::::test::Temp<int>::State &)'
Thanks for your bug report. This problem is fixed in the latest
snapshot of egcs.
> I don't understand the second warning (l33). Could someone explain me what
> happens here ?
You can't pass a temporary to a function that gets a non-const
reference. But you were not doing this, anyway...
> And last question : why do I need to explicitely instanciate
> test::Temp<int>::Bug, shouldn't it be instanciated with the first instanciation
> (test::Temp<int>) ?
You don't have to. In fact, the latest snapshot of egcs will even
complain about the duplicate explicit instantiation.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list