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

            Bug ID: 90703
           Summary: A virtuous bug: `=delete` accepted on second
                    declaration
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eyalroz at technion dot ac.il
  Target Milestone: ---

(based on this SE question: https://stackoverflow.com/q/56409551/1593077
and this GodBolt test case: https://godbolt.org/z/YNstQX 
)

Consider this code:

    template <typename T> int foo();
    template <typename T> int foo() = delete;

it seems to be invalid in C++11 and onward:

    [dcl.fct.def.delete]

    4 ... A deleted definition of a function shall be the first declaration of
the function...

Un(?)fortunately, GCC accepts this code as valid C++11, beginning with 4.7.1
and all the way up to the "trunk" version that GodBolt uses. Specifically,
version 9.1 accepts it.


(Personally I feel the standard should correspond to GCC's behavior on this
matter but it's not for me to decide.)

Reply via email to