[Bug c++/51424] New: [C++11] G++ should diagnose self-delegating constructors
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 5 16:10:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51424
Bug #: 51424
Summary: [C++11] G++ should diagnose self-delegating
constructors
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jason@gcc.gnu.org
CC: pedro.lamarao@gmail.com, ville.voutilainen@gmail.com
This modification of g++.dg/template/meminit1.C should get a diagnostic in
C++11 mode as well:
template <class T >
struct S
{
S() : S() {} // { dg-message "delegating constructors" "" { target c++98 } }
// { dg-error "delegates to itself" "" { target c++11 } }
};
S<int> s;
because 12.6.2 says,
"If a constructor delegates to itself directly or indirectly, the program is
ill-formed; no diagnostic is required."
The diagnostic is not required, but it is easy to give, so we should do so.
More information about the Gcc-bugs
mailing list