public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25814]  New: Request for new warning
@ 2006-01-17  0:42 Raimund dot Merkert at baesystems dot com
  2006-01-17  0:58 ` [Bug c++/25814] Request for warning for parser ambiguity of function declarations and variable declarations with initializations pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Raimund dot Merkert at baesystems dot com @ 2006-01-17  0:42 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <bug-25814-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2020-11-05 20:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-17  0:42 [Bug c++/25814] New: Request for new warning Raimund dot Merkert at baesystems dot com
2006-01-17  0:58 ` [Bug c++/25814] Request for warning for parser ambiguity of function declarations and variable declarations with initializations pinskia at gcc dot gnu dot org
2006-01-17  4:01 ` gdr at cs dot tamu dot edu
2006-01-17 12:33 ` Raimund dot Merkert at baesystems dot com
2006-02-02 19:54 ` pinskia at gcc dot gnu dot org
2006-03-08  5:07 ` bangerth at dealii dot org
2006-11-14 15:36 ` wolfgang dot roemer at gmx dot net
2006-11-14 15:52 ` Raimund dot Merkert at baesystems dot com
     [not found] <bug-25814-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:59 ` jakub at gcc dot gnu.org
2020-08-26 12:22 ` mpolacek at gcc dot gnu.org
2020-08-27 11:12 ` dmalcolm at gcc dot gnu.org
2020-08-27 14:33 ` mpolacek at gcc dot gnu.org
2020-10-22 15:02 ` mpolacek at gcc dot gnu.org
2020-11-05 20:56 ` cvs-commit at gcc dot gnu.org
2020-11-05 20:59 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).