https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67574
Bug ID: 67574
Summary: Misleading error message for method explicitly
defaulted two times
Product: gcc
Version: 5.1.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: arvo at me dot com
Target Milestone: ---
Created attachment 36334
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36334&action=edit
Minimal test program (no headers/macros)
g++ (Ubuntu 5.1.1-4ubuntu12) 5.1.1 20150504
x86_64 GNU/Linux
Ubuntu 15.04
Command line: g++ -c -std=c++11 redefaulted.cxx
Compiling the attached test program results in the following diagnostic:
redefaulted.cxx:7:1: error: definition of explicitly-defaulted ‘X::X()’
X::X() = default;
^
redefaulted.cxx:1:8: error: ‘X::X()’ explicitly defaulted here
struct X
^
This is misleading as X::X() was first defined (and explicitly defaulted) in
line 6, not line 1, and not even in the struct definition.