[Bug c++/40307] New: Problem with auto deducing class type inside one of its own member functions
public at alisdairm dot net
gcc-bugzilla@gcc.gnu.org
Sat May 30 14:36:00 GMT 2009
The following code demonstrates the problem. It should compile cleanly, as
demonstrated by the run_pass function, but the run_fail function generates an
error:
template< typename T >
struct test {
test run_pass() {
test tmp( *this );
return tmp;
}
test run_fail() {
auto tmp( *this );
return tmp;
}
};
int main()
{
test<int> x;
x.run_pass();
x.run_fail();
return 0;
}
Compiler output:
||=== AutoBug02, Debug ===|
In member function 'test<T> test<T>::run_fail() [with T = int]':
instantiated from here
error: 'tmp' has incomplete type
||=== Build finished: 1 errors, 0 warnings ===|
--
Summary: Problem with auto deducing class type inside one of its
own member functions
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: public at alisdairm dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40307
More information about the Gcc-bugs
mailing list