public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94944] New: compile error accessing member function of dependent base class template in exception specification
@ 2020-05-04 15:39 eracpp at eml dot cc
  2020-05-04 15:41 ` [Bug c++/94944] " eracpp at eml dot cc
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: eracpp at eml dot cc @ 2020-05-04 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94944
           Summary: compile error accessing member function of dependent
                    base class template in exception specification
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eracpp at eml dot cc
  Target Milestone: ---

GCC fails to compile a qualified invocation of a member function of a dependent
base class template when used within an exception specification:

----
template <typename T>
struct B {
  void foo(T t) {}
};

template <typename T>
struct D : B<T> {
  void foo(T t) noexcept(noexcept(B<T>::foo(t))) {}
};

template struct D<int>;
----

The error message is as follows:

----
error: cannot call member function 'void B<T>::foo(T) [with T = int]' without
object
    8 |   void foo(T t) noexcept(noexcept(B<T>::foo(t))) {}
      |
----

Clang and MSVC accept the code as given without error:
https://gcc.godbolt.org/z/MW2iQz

Note, a workaround accepted by all three major compilers is to qualify the
invocation with `this->`:

----
void foo(T t) noexcept(noexcept(this->B<T>::foo(t))) {}
----

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

end of thread, other threads:[~2022-02-18  1:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 15:39 [Bug c++/94944] New: compile error accessing member function of dependent base class template in exception specification eracpp at eml dot cc
2020-05-04 15:41 ` [Bug c++/94944] " eracpp at eml dot cc
2020-05-04 15:56 ` mpolacek at gcc dot gnu.org
2021-12-09  1:46 ` [Bug c++/94944] compile error accessing member function of dependent base class template in noexcept specification pinskia at gcc dot gnu.org
2022-02-16 21:14 ` pinskia at gcc dot gnu.org
2022-02-17 14:14 ` ppalka at gcc dot gnu.org
2022-02-18  1:22 ` cvs-commit at gcc dot gnu.org
2022-02-18  1:24 ` ppalka 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).