public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101677] New: [11 Regression] Concept with use of incomplete type succeeds on GCC 10.3.0, fails on GCC 11 onward
@ 2021-07-29 15:58 joeloser93 at gmail dot com
  2021-07-30  6:13 ` [Bug c++/101677] [11/12 " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: joeloser93 at gmail dot com @ 2021-07-29 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101677
           Summary: [11 Regression] Concept with use of incomplete type
                    succeeds on GCC 10.3.0, fails on GCC 11 onward
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joeloser93 at gmail dot com
  Target Milestone: ---

A concept that uses an incomplete type in testing the well-formedness of
calling a function template is well-formed in GCC 10.3.0, but fails in GCC 11
onward (including trunk at the time of this writing).

For example, consider the following:

template<class T>
concept C_bug_with_forward_decl = requires(T& t){
    t.template f<class S>();
};

struct good {
    template<class T> auto f() -> void {}
};

static_assert(C_bug_with_forward_decl<good>); // works in GCC 10.3.0, fails on
GCC 11 onward

This bug can be worked around by using a complete type instead when defining
the concept. For example:

struct U{};
template<class T>
concept C_workaround = requires(T& t){
    t.template f<U>();
};

static_assert(C_workaround<good>); // works on GCC 10.3.0 and GCC 11 onward

See it live at https://godbolt.org/z/h7GzqGhYn

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 15:58 [Bug c++/101677] New: [11 Regression] Concept with use of incomplete type succeeds on GCC 10.3.0, fails on GCC 11 onward joeloser93 at gmail dot com
2021-07-30  6:13 ` [Bug c++/101677] [11/12 " rguenth at gcc dot gnu.org
2021-07-30  6:25 ` pinskia at gcc dot gnu.org
2021-07-30 15:50 ` joeloser93 at gmail dot com
2022-01-17 13:59 ` rguenth at gcc dot gnu.org
2022-04-01 19:30 ` jason at gcc dot gnu.org
2022-04-05 16:29 ` cvs-commit at gcc dot gnu.org
2022-04-12 20:14 ` [Bug c++/101677] [11 " cvs-commit at gcc dot gnu.org
2022-04-12 20:22 ` jason at gcc dot gnu.org
2023-06-09 14: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).