public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100374] New: Type-constraints of member function templates should not be substituted into during implicit instantiation
@ 2021-05-01 13:48 rs2740 at gmail dot com
  2021-05-03 15:20 ` [Bug c++/100374] " ppalka at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rs2740 at gmail dot com @ 2021-05-01 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100374
           Summary: Type-constraints of member function templates should
                    not be substituted into during implicit instantiation
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

template<class T, class U>
concept C = true;

template <class T>
struct Foo
{
  template <C<typename T::value_type> U>
  void bar()
  {
  }
};

Foo<float> f;

GCC trunk with -std=c++20 produces:

<source>: In instantiation of 'struct Foo<float>':
<source>:13:12:   required from here
<source>:8:8: error: 'float' is not a class, struct, or union type
    8 |   void bar()
      |        ^~~

[temp.inst]/17 says that type-constraints like C<typename T::value_type> should
not be substituted into during the implicit instantiation of the declaration of
Foo<float>::bar:

The type-constraints and requires-clause of a template specialization or member
function are not instantiated along with the specialization or function itself,
even for a member function of a local class; substitution into the atomic
constraints formed from them is instead performed as specified in
[temp.constr.decl] and [temp.constr.atomic] when determining whether the
constraints are satisfied or as specified in [temp.constr.decl] when comparing
declarations.

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

end of thread, other threads:[~2022-07-21 16:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-01 13:48 [Bug c++/100374] New: Type-constraints of member function templates should not be substituted into during implicit instantiation rs2740 at gmail dot com
2021-05-03 15:20 ` [Bug c++/100374] " ppalka at gcc dot gnu.org
2022-05-27 18:40 ` ppalka at gcc dot gnu.org
2022-06-03 13:29 ` cvs-commit at gcc dot gnu.org
2022-07-21 16:48 ` cvs-commit at gcc dot gnu.org
2022-07-21 16:49 ` 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).