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

            Bug ID: 110836
           Summary: g++ should report when there is no way to create
                    structure or class
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andris at gcc dot gnu.org
  Target Milestone: ---

Created attachment 55651
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55651&action=edit
example

GCC should report when there is no way to create structure or class instance.

At least warning would be required (preferably enabled by default or -Wall)
It could even be an error 

Possible reasons why it could be impossible to create object (list can be
incomplete):
- at least one deleted constructor present and no other constructors
- only copy constructor
- only private destructor
- only private constructor and no static methods (should exclude possibility of
factory methods as there is no way to detect them from declaration only when
static methods are present)

Currently problem is only detected when there is an attempt to create object,
but it should be also detectable from header files only

Reply via email to