Bug 48255 - default constructor with argument INT
Summary: default constructor with argument INT
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-23 15:43 UTC by Lisp2D
Modified: 2011-03-23 16:15 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lisp2D 2011-03-23 15:43:22 UTC
class A{
public:
};

A x; // OK
A y(1); //OK

I can't found that standard says: default constructor with argument INT.

By code protection I will write:

class A{
A(); // w/o definition
A(int); // w/o definition
public:
};

What to do?
Comment 1 Richard Biener 2011-03-23 15:55:36 UTC
t.C:5:6: error: no matching function for call to ‘A::A(int)’
t.C:1:8: note: candidates are: A::A()
t.C:1:8: note:                 A::A(const A&)

your code example is rejected as it should.
Comment 2 Lisp2D 2011-03-23 16:15:14 UTC
found silent conversion

class A have

explicit A(std::complex<long double>const& x);