public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110836] New: g++ should report when there is no way to create structure or class
@ 2023-07-28  6:08 andris at gcc dot gnu.org
  2023-07-28  6:20 ` [Bug c++/110836] [C++20] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: andris at gcc dot gnu.org @ 2023-07-28  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

end of thread, other threads:[~2023-07-28  8:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28  6:08 [Bug c++/110836] New: g++ should report when there is no way to create structure or class andris at gcc dot gnu.org
2023-07-28  6:20 ` [Bug c++/110836] [C++20] " pinskia at gcc dot gnu.org
2023-07-28  6:43 ` andris at gcc dot gnu.org
2023-07-28  8:20 ` redi at gcc dot gnu.org
2023-07-28  8:21 ` redi 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).