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

            Bug ID: 80599
           Summary: -Wuseless-cast triggers for inherited constructor
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.maurer at gmx dot net
  Target Milestone: ---

All-new gcc 7.1.0 delivers a -Wuseless-cast warning for inherited constructors
involving reference parameters that the user cannot do anything about.  This
did not happen with gcc 6.3.0.

struct B {
  B(const int&);
};

struct D : B {
  using B::B;
};

D d2 = 0;


$ g++ -Wuseless-cast -c y.cc

y.cc: In constructor ‘D::D(const int&) [inherited from B]’:
y.cc:6:12: warning: useless cast to type ‘const int&’ [-Wuseless-cast]
   using B::B;
            ^
y.cc: At global scope:
y.cc:9:8: note: synthesized method ‘D::D(const int&) [inherited from B]’ first
required here 
 D d2 = 0;
        ^

Reply via email to