http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57903
Bug ID: 57903
Summary: Object not getting constructed - Code misinterpreted
as function declaration?
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: michael at dietschi dot net
Created attachment 30508
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30508&action=edit
Source file triggering the bug
Compiling this code:
class A
{
public:
A( int ) {}
};
class C
{
public:
C( A ) {}
void f() {}
};
int main( int /*argc*/, char */*argv*/[] )
{
int i = 0;
// OK
A a(i);
C c1(a);
c1.f();
// OK
C c2 = C( A(i) );
c2.f();
// not OK - why?
C c3( A(i) ); // It seems that c2 is not seen as an object but a function
declaration...
c3.f(); // ...hence this line forces a linker error!
return 0;
}
with this command-line: g++-4.6 -v -save-temps strange.cpp