https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67670

            Bug ID: 67670
           Summary: [c++11] Misleading / outdated error message "invalid
                    pure specifier"
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arvo at me dot com
  Target Milestone: ---

Created attachment 36367
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36367&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 wrong-default.cxx

command output:
wrong-default.cxx:6:17: error: invalid pure specifier (only ‘= 0’ is allowed)
before ‘;’ token
 X::X() = defaut;
                ^
wrong-default.cxx:6:17: error: function ‘X::X()’ is initialized like a variable

I am not suggesting a "Did you mean 'default'?" message, but, in C++11,
obviously the statement "only '= 0' is allowed" is wrong. That is true for the
*pure-specifier*, an optional part of a *member-declarator*, but '= default' or
'= delete' is valid as a *function-body* in a *function-definition*. Curiously,
a *member-declarator* may only occur inside a *class-specifier*, which means
that '= 0' is not even allowed here, even for a virtual method of X (though I
am only looking at draft N3690).

Reply via email to