public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105610] New: warn about cv qualifiers ignored for a base class
@ 2022-05-15 12:43 fsb4000 at yandex dot ru
  2022-05-16  8:43 ` [Bug c++/105610] " redi at gcc dot gnu.org
  2022-05-16  9:34 ` fsb4000 at yandex dot ru
  0 siblings, 2 replies; 3+ messages in thread
From: fsb4000 at yandex dot ru @ 2022-05-15 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105610
           Summary: warn about cv qualifiers ignored for a base class
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fsb4000 at yandex dot ru
  Target Milestone: ---

No bug here, but a feature request.

it would be nice if for such code

class Base { 
public:
   int base;
};

typedef const Base ConstBase;

class CDerived: public ConstBase {
public:
   int derived;
};

gcc reports a warning.

http://eel.is/c++draft/class.derived.general#2.sentence-2

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

* [Bug c++/105610] warn about cv qualifiers ignored for a base class
  2022-05-15 12:43 [Bug c++/105610] New: warn about cv qualifiers ignored for a base class fsb4000 at yandex dot ru
@ 2022-05-16  8:43 ` redi at gcc dot gnu.org
  2022-05-16  9:34 ` fsb4000 at yandex dot ru
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-16  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't see any benefit to this warning. What harm does the example code do?
Has anybody ever been confused about the semantics, and expected the
cv-qualifiers to have an effect?

If this language feature doesn't lead to confusion or mistaken code, why should
there be a warning?

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

* [Bug c++/105610] warn about cv qualifiers ignored for a base class
  2022-05-15 12:43 [Bug c++/105610] New: warn about cv qualifiers ignored for a base class fsb4000 at yandex dot ru
  2022-05-16  8:43 ` [Bug c++/105610] " redi at gcc dot gnu.org
@ 2022-05-16  9:34 ` fsb4000 at yandex dot ru
  1 sibling, 0 replies; 3+ messages in thread
From: fsb4000 at yandex dot ru @ 2022-05-16  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from fsb4000 at yandex dot ru ---
>Has anybody ever been confused about the semantics, and expected the cv-qualifiers to have an effect?

Yes. I saw a question on one forum why constness is not taken into account when
inheriting and whether there is a compiler bug.

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

end of thread, other threads:[~2022-05-16  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-15 12:43 [Bug c++/105610] New: warn about cv qualifiers ignored for a base class fsb4000 at yandex dot ru
2022-05-16  8:43 ` [Bug c++/105610] " redi at gcc dot gnu.org
2022-05-16  9:34 ` fsb4000 at yandex dot ru

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).