This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65652] New: defaulted default constructor
- From: "wolfgang dot roehrl at gi-de dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 01 Apr 2015 12:44:02 +0000
- Subject: [Bug c++/65652] New: defaulted default constructor
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65652
Bug ID: 65652
Summary: defaulted default constructor
Product: gcc
Version: 4.8.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: wolfgang.roehrl@gi-de.com
Hi,
I would like to post a bug report for the GNU C/C++ compiler 4.8.3.
We use the compiler to generate code for a PowerPC processor.
Invokation line for the GNU C++ compiler:
ccppc -c -x c++ -std=c++11 -Wall -Werror -g -mcpu=8540 -meabi
-ftls-model=local-exec -msdata=sysv -fno-common -mspe -mabi=spe
-mfloat-gprs=double -mbig -mmultiple -mno-string -misel -mstrict-align
-fverbose-asm -fno-exceptions -fno-rtti -fgcse-sm -fno-section-anchors
-ftemplate-backtrace-limit=20 -G 8 -O3
-I<some include paths>
-D<some #define's>
X.CPP -oX.O
// file X.CPP
struct S
{
// S () = default;
S (const S&) = delete;
S& operator= (const S&) = delete;
};
S x;
The compiler rejects this programm with the following message:
x.CPP:9:3: error: no matching function for call to 'S::S()'
S x;
^
x.CPP:9:3: note: candidate is:
x.CPP:5:5: note: S::S(const S&) <deleted>
S (const S&) = delete;
^
x.CPP:5:5: note: candidate expects 1 argument, 0 provided
I think this is not standard conforming. The C++11 standard, 12.1/5 says:
"If there is no user-declared constructor for class X, a constructor having
no parameters is implicitly declared as defaulted (8.4)." I don't think that
"S (const S&) = delete;" should be counted as a user-declared constructor.
Notes:
. If line 3 is uncommented the compiler accepts the programm.
. IF line 5 is commented out the compiler accepts the programm.
With kind regards
W. Roehrl