public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101789] New: Fails to match (re-)declaration of member function of class template when using an alias template for the (dependent) return type
@ 2021-08-05 10:05 davveston at gmail dot com
  2022-12-26  7:24 ` [Bug c++/101789] " pinskia at gcc dot gnu.org
  2023-06-09 12:36 ` ppalka at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: davveston at gmail dot com @ 2021-08-05 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101789
           Summary: Fails to match (re-)declaration of member function of
                    class template when using an alias template for the
                    (dependent) return type
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: davveston at gmail dot com
  Target Milestone: ---

(Broken out into a separate report, from my comment to Bug 69348, after prompt
by Andrew Pinski)

---

The following program 

template<typename T>
struct S {
    using type = int;
    type f() const;  // #1
};

template<typename T>
using type_t = typename S<T>::type;

template <typename T>
type_t<T> S<T>::f() const { }  // #2a
// error: no declaration matches 'type_t<T> S<T>::f() const'

int main() {}


is rejected e.g. for GCC 11.1.0 for all C++ versions (-std=c++X with X in {11,
17, 2a/2b}), failing to match the (re-)declaration and definition at #2a of the
member function of the class template at #1, when using an alias template for
the dependent return type of the member function. Clang accepts this program.

The program is accepted if we remove the alias template

template <typename T>
typename S<T>::type S<T>::f() const { }  // #2b: OK

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

* [Bug c++/101789] Fails to match (re-)declaration of member function of class template when using an alias template for the (dependent) return type
  2021-08-05 10:05 [Bug c++/101789] New: Fails to match (re-)declaration of member function of class template when using an alias template for the (dependent) return type davveston at gmail dot com
@ 2022-12-26  7:24 ` pinskia at gcc dot gnu.org
  2023-06-09 12:36 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-26  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-12-26
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed (I forgot to confirm it when it was split off).
Both MSVC and clang accept the code.

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

* [Bug c++/101789] Fails to match (re-)declaration of member function of class template when using an alias template for the (dependent) return type
  2021-08-05 10:05 [Bug c++/101789] New: Fails to match (re-)declaration of member function of class template when using an alias template for the (dependent) return type davveston at gmail dot com
  2022-12-26  7:24 ` [Bug c++/101789] " pinskia at gcc dot gnu.org
@ 2023-06-09 12:36 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-06-09 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fchelnokov at gmail dot com

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 110191 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-06-09 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 10:05 [Bug c++/101789] New: Fails to match (re-)declaration of member function of class template when using an alias template for the (dependent) return type davveston at gmail dot com
2022-12-26  7:24 ` [Bug c++/101789] " pinskia at gcc dot gnu.org
2023-06-09 12:36 ` 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).