public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hewillk at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/111712] New: Syntax error when passing function parameter as NTTP in requires-clause
Date: Fri, 06 Oct 2023 05:31:11 +0000	[thread overview]
Message-ID: <bug-111712-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 111712
           Summary: Syntax error when passing function parameter as NTTP
                    in requires-clause
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Regardless of whether the code is well-formed or not, this should be valid
syntax

https://godbolt.org/z/4qM9nG4WP

#include <type_traits>

template<bool B>
void f(std::bool_constant<B> b)
  requires requires { typename std::bool_constant<b()>; };

int main() {
  f(std::true_type{});
}

However, GCC givs

<source>:5:54: error: template argument 1 is invalid
<source>:5:37: error: invalid use of template-name 'std::bool_constant' without
an argument list
    5 |   requires requires { typename std::bool_constant<b()>; };
      |                                     ^~~~~~~~~~~~~
In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20231005/include/c++/14.0.0/type_traits:120:11:
note: 'template<bool __v> using std::bool_constant = std::__bool_constant<__v>'
declared here
  120 |     using bool_constant = __bool_constant<__v>;
      |           ^~~~~~~~~~~~~
<source>:5:50: error: expected '(' before '<' token
    5 |   requires requires { typename std::bool_constant<b()>; };
      |                                                  ^
      |                                                  (
<source>:5:55: error: expected primary-expression before ';' token
    5 |   requires requires { typename std::bool_constant<b()>; };
      |                                                       ^

             reply	other threads:[~2023-10-06  5:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06  5:31 hewillk at gmail dot com [this message]
2023-10-06  9:03 ` [Bug c++/111712] " pinskia at gcc dot gnu.org
2023-10-06 13:42 ` ppalka at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111712-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).