public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/82833] [concepts] Out-of-line definition of nested class template errors with constraint (ICE)
       [not found] <bug-82833-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-19  0:08 ` pinskia at gcc dot gnu.org
  2021-07-19 10:04 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-19  0:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.3
             Status|NEW                         |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was fixed in GCC 10.3 (note 10.2 also rejects it).

I suspect it was fixed with r11-3296 (10 version: r10-9634 )

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

* [Bug c++/82833] [concepts] Out-of-line definition of nested class template errors with constraint (ICE)
       [not found] <bug-82833-4@http.gcc.gnu.org/bugzilla/>
  2021-07-19  0:08 ` [Bug c++/82833] [concepts] Out-of-line definition of nested class template errors with constraint (ICE) pinskia at gcc dot gnu.org
@ 2021-07-19 10:04 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-19 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Looks like the ICE was fixed by the concepts rewrite in r10-3735 "Update the
concepts implementation to conform to C++20."


Valid C++20 testcase:

#include <functional>
#include <concepts>

template <typename T, auto A, typename M>
concept CallYieldsType = requires(T t) {
  { std::invoke(A, t) } -> std::same_as<M>;
};

template <typename T>
struct S {
  struct Z;


  template <auto A>
    requires CallYieldsType<T, A, Z>
  struct N;
};

template <typename T>
template <auto A>
  requires CallYieldsType<T, A, typename S<T>::Z>
struct S<T>::N {
  Z &f(T t) {
    return std::invoke(A, t);
  }
};


Bisections shows this started to be accepted with r11-3713:

    c++: Set the constraints of a class type sooner [PR96229]

    In the testcase below, during processing (at parse time) of Y's base
    class X<Y>, convert_template_argument calls is_compatible_template_arg
    to check if the template argument Y is no more constrained than the
    parameter P.  But at this point we haven't yet set Y's constraints, so
    get_normalized_constraints_from_decl yields NULL_TREE as the normal form
    and caches this result into the normalized_map.

    We set Y's constraints later in cp_parser_class_specifier_1 but the
    stale normal form in the normalized_map remains.  This ultimately causes
    us to miss the constraint failure for Y<Z> because according to the
    cached normal form, Y is not constrained.

    This patch fixes this issue by moving up the call to
    associate_classtype_constraints so that we set constraints before we
    start processing a class's bases.

    gcc/cp/ChangeLog:

            PR c++/96229
            * parser.c (cp_parser_class_specifier_1): Move call to
            associate_classtype_constraints from here to ...
            (cp_parser_class_head): ... here.
            * pt.c (is_compatible_template_arg): Correct documentation to
            say "argument is _no_ more constrained than the parameter".

    gcc/testsuite/ChangeLog:

            PR c++/96229
            * g++.dg/cpp2a/concepts-class2.C: New test.

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

end of thread, other threads:[~2021-07-19 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-82833-4@http.gcc.gnu.org/bugzilla/>
2021-07-19  0:08 ` [Bug c++/82833] [concepts] Out-of-line definition of nested class template errors with constraint (ICE) pinskia at gcc dot gnu.org
2021-07-19 10:04 ` redi 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).