I'd like to request a warning to notify that a statement like "X x(const Y&)" is parsed as function declaration and not a definition of variable x. See the code below.
At least as couple of PRs have been filed (9217,19503) on this topic. I've just spent at least 2 hrs trying to figure out why my constructor and destructor were not called and did not show up in the assembly code either. I think this particular problem might affect users that use the resource-acquisition idiom. The real problem is that the code compiles and links and runs without problems, except it doesn't actually work. #include <cstdio> struct Y {}; struct X { inline X (const Y&) {} inline ~X () { ::std::printf("1\n"); } }; int main() { X x(Y()); return 0; } -- Summary: Request for new warning Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Raimund dot Merkert at baesystems dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25814