public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98756] New: Suspicious "(*this)." in mangled symbol
@ 2021-01-19 22:28 mpolacek at gcc dot gnu.org
  2021-01-22 14:00 ` [Bug c++/98756] " ensadc at mailnesia dot com
  2021-01-22 14:12 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-19 22:28 UTC (permalink / raw)
  To: gcc-bugs

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.

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

* [Bug c++/98756] Suspicious "(*this)." in mangled symbol
  2021-01-19 22:28 [Bug c++/98756] New: Suspicious "(*this)." in mangled symbol mpolacek at gcc dot gnu.org
@ 2021-01-22 14:00 ` ensadc at mailnesia dot com
  2021-01-22 14:12 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ensadc at mailnesia dot com @ 2021-01-22 14:00 UTC (permalink / raw)
  To: gcc-bugs

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

ensadc at mailnesia dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ensadc at mailnesia dot com

--- Comment #1 from ensadc at mailnesia dot com ---
Reduced:

```
class a {};
struct f {
  template <class d, class e>
  int operator()(d, double, e);
};
struct i : f {
  template <class... g>
  auto h(g...) -> decltype(operator()(g()...)) {}
// { dg-final { scan-assembler
"_ZN1i1hIJ1adS1_EEEDTcldtdefpTonclspcvT__EEEDpS2_" } }
};
a m, n;
int p = i{}.h(m, 1.0, n);
```

This is similar to the case mentioned in
https://itanium-cxx-abi.github.io/cxx-abi/cxx-abi-dev/archives/2011-July/002420.html
(but Clang does emit 'dtdefpT' in that example).

Itanium C++ ABI does not (yet) specify what to do in this case.

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

* [Bug c++/98756] Suspicious "(*this)." in mangled symbol
  2021-01-19 22:28 [Bug c++/98756] New: Suspicious "(*this)." in mangled symbol mpolacek at gcc dot gnu.org
  2021-01-22 14:00 ` [Bug c++/98756] " ensadc at mailnesia dot com
@ 2021-01-22 14:12 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-22 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-01-22

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Ah, thanks.  Confirmed thus.

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

end of thread, other threads:[~2021-01-22 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 22:28 [Bug c++/98756] New: Suspicious "(*this)." in mangled symbol mpolacek at gcc dot gnu.org
2021-01-22 14:00 ` [Bug c++/98756] " ensadc at mailnesia dot com
2021-01-22 14:12 ` mpolacek 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).