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

            Bug ID: 97785
           Summary: const_cast<Y&> shows diagnostic about Y*
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

struct X { };
struct Y { };

X x;
Y& y = const_cast<const Y&>(x);



cc.cc:5:8: error: invalid ‘const_cast’ from type ‘X*’ to type ‘const Y*’
    5 | Y& y = const_cast<const Y&>(x);
      |        ^~~~~~~~~~~~~~~~~~~~~~~


There is no X* or Y* here.

Reply via email to