This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71484] New: Class with implicit public constructor triggers `-Wctor-dtor-privacy`


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

            Bug ID: 71484
           Summary: Class with implicit public constructor triggers
                    `-Wctor-dtor-privacy`
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kyle.strand at beckman dot com
  Target Milestone: ---

A class whose only user-declared methods are `private`, but which *does* have
an implicit public constructor, can trigger `-Wctor-dtor-privacy`.

See http://stackoverflow.com/q/33157248/1858225 for discussion and sample code.

The offending code is copied here for convenience:

    struct foo
    {
      private:
        static int test(void) { return 3; };
    };

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]