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

kyle.strand at beckman dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 9 21:10:00 GMT 2016


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; };
    };


More information about the Gcc-bugs mailing list