Temporary created with default constructor in return bogus error

Drew Eckhardt drew@plutotech.com
Sat Mar 27 18:50:00 GMT 1999


Temporaries created using the default constructor within a return
statement in an inline member function cause the compiler to puke
although foo tmp = foo() works fine.

Script started on Sat Mar 27 19:43:19 1999
drew@pluto (drew_baseline)% g++  -c default_constructor_temporary.cc
default_constructor_temporary.cc: In method `class foo::iterator foo::end()':
default_constructor_temporary.cc:5: parse error before `;'
drew@pluto (drew_baseline)% g++ -v
Reading specs from /usr/local/lib/gcc-lib/i386-unknown-freebsd3.1/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
drew@pluto (drew_baseline)% cat default_constructor_temporary.cc
class foo {
public:
    class iterator {
    };
    iterator end () { return (iterator()); }
};
drew@pluto (drew_baseline)% exit
exit

Script done on Sat Mar 27 19:43:50 1999

-- 
Work: <drew@plutotech.com>   | For those who don't, no explanation is possible.
Play: <drew@poohsticks.org>  | For those who do, no explanation is necessary.  
Home page: http://www.poohsticks.org/drew/ ">Home Page</a>


More information about the Gcc-bugs mailing list