[Bug c++/98756] New: Suspicious "(*this)." in mangled symbol

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 19 22:28:53 GMT 2021


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

            Bug ID: 98756
           Summary: Suspicious "(*this)." in mangled symbol
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

For the test in PR98545:

// PR c++/98545
// { dg-do compile { target c++11 } }

class a {
public:
  a();
  template <typename b> a(b);
};
template <class = double> using c = a;
class f {
protected:
  template <class d, class e> void operator()(d, double, e);
};
class i : f {
public:
  template <class... g>
  [[gnu::used]] auto h(g...) -> decltype(operator()(g()...)) {}
// { dg-final { scan-assembler
"_ZN1i1hIJ1adS1_EEEDTcldtdefpTonclspcvT__EEEDpS2_" } }
};
template <class> class C {
public:
  template <class j> C(j);
  i k() const;
  int operator()() {
    int l = 10;
    c<> m, n;
    operator()(m, l, n);
    return 0;
  }
  int operator()(c<> &, c<> const &, c<> const &) const;
  template <class d, class e> void k(d m, double gamma, e o) const {
    k().h(m, gamma, o);
  }
};
template <class r> int C<r>::operator()(c<> &, c<> const &, c<> const &) const
{
  [&](c<> m, double gamma, c<> o) { k(m, gamma, o); };
  return 0;
}
c<> p = C<double>(p)();

we emit
$ c++filt _ZN1i1hIJ1adS1_EEEDTcldtdefpTonclspcvT__EEEDpS2_
decltype (((*this).(operator()))((a)(), (double)(), (a)())) i::h<a, double,
a>(a, double, a)

though other compilers emit:

$ c++filt _ZN1i1hIJ1adS1_EEEDTclonclspcvT__EEEDpS2_
decltype ((operator())((a)(), (double)(), (a)())) i::h<a, double, a>(a, double,
a)

as mentioned in
<https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563419.html>.

This should be investigated.


More information about the Gcc-bugs mailing list