public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36183]  New: missleading error message with explicit copy constructor call
@ 2008-05-08 23:21 4ertus2 at mail dot ru
  0 siblings, 0 replies; only message in thread
From: 4ertus2 at mail dot ru @ 2008-05-08 23:21 UTC (permalink / raw)
  To: gcc-bugs

class B
{
  public:
    B() {}
    explicit B(const B& ref) {}
};

void f(B obj) {}

int main()
{
  const B b;
  const B& r(b);
  f(b); // error: no matching function for call to 'B::B(const B&)'
        // error:   initializing argument 1 of 'void f(B)'
  f(r); // error: no matching function for call to 'B::B(const B&)'
        // error:   initializing argument 1 of 'void f(B)'
  return 0;
}

The problem is in casting from const B& to B, not in coustructor existence.


-- 
           Summary: missleading error message with explicit copy constructor
                    call
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: 4ertus2 at mail dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36183


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-08 23:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-08 23:21 [Bug c++/36183] New: missleading error message with explicit copy constructor call 4ertus2 at mail dot ru

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).