This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26062] New: "Class object();" is not interpreted as a call to default constructor
- From: "sylvain dot joyeux at m4x dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Feb 2006 13:19:15 -0000
- Subject: [Bug c++/26062] New: "Class object();" is not interpreted as a call to default constructor
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following testcase
#include <iostream>
bool flag = true;
class guardian
{
public:
guardian() { flag = false; }
~guardian() { flag = true; }
bool get() { return flag; }
};
int main()
{
guardian guard();
std::cout << guard.get() << std::endl;
std::cout << flag << std::endl;
}
Leads to the error
error: request for member 'get' in 'guard', which is of non-class type
'guardian ()()'
Note that it makes guard to *not* being constructed at all, which fails
silently if we don't call any method on the object.
I'm using
gcc (GCC) 4.0.3 20060115 (prerelease) (Debian 4.0.2-7) on powerpc-linux-gnu
--
Summary: "Class object();" is not interpreted as a call to
default constructor
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sylvain dot joyeux at m4x dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26062