public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96207] New: GCC accepts "delete" function definition inside a class member function
@ 2020-07-15 14:58 haoxintu at gmail dot com
  2021-12-11  2:10 ` [Bug c++/96207] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: haoxintu at gmail dot com @ 2020-07-15 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96207
           Summary: GCC accepts "delete" function definition inside a
                    class member function
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi, all.

This code, test.cc, is an invalid code, GCC compiles it well, while other
mainstream compiles (clang,icc,and msvc) all reject it.

$cat test.cc
class A {
    void foo1 () {    
        void foo2 () = delete  ;
    }
};

$g++ -c test.cc
test.cc: In member function ‘void A::foo1()’:
test.cc:3:20: warning: declaration of ‘void foo2()’ has ‘extern’ and is
initialized
    3 |         void foo2 () = delete  ;
      |                    ^

GCC only emits a warning message (I also doubt that the meaning of this
message) and then accepts it.

Every Clang version from 6.x onwards behaves the same.

Thanks,
Haoxin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/96207] GCC accepts "delete" function definition inside a class member function
  2020-07-15 14:58 [Bug c++/96207] New: GCC accepts "delete" function definition inside a class member function haoxintu at gmail dot com
@ 2021-12-11  2:10 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-11  2:10 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-11

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-11  2:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 14:58 [Bug c++/96207] New: GCC accepts "delete" function definition inside a class member function haoxintu at gmail dot com
2021-12-11  2:10 ` [Bug c++/96207] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).