public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95735] New: ICE on invalid non-type template argument
@ 2020-06-18  6:09 johelegp at gmail dot com
  2020-06-18  7:40 ` [Bug c++/95735] " marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2020-06-18  6:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95735
           Summary: ICE on invalid non-type template argument
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/v7iLPn.
```C++
template <auto F>
    requires requires { F(); }
bool v{};

void f() {
    int x;
    static_assert(v<throw>);
}
```
<source>: In function 'void f()':
<source>:7:19: error: parse error in template argument list
    7 |     static_assert(v<throw>);
      |                   ^~~~~~~~
<source>:7:19: error: template argument 1 is invalid
<source>:7: confused by earlier errors, bailing out
Compiler returned: 1

Less silly example: https://godbolt.org/z/-bWfJ4.
```C++
template <auto F>
    requires requires { F(); }
bool v{};

void f() {
    int x;
    static_assert(v<[&] { x++; }>);
}
```
<source>: In function 'void f()':
<source>:7:19: error: '<lambda closure object>f()::<lambda()>{x}' is not a
constant expression
    7 |     static_assert(v<[&] { x++; }>);
      |                   ^~~~~~~~~~~~~~~
<source>:7: confused by earlier errors, bailing out
Compiler returned: 1

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

end of thread, other threads:[~2020-06-18 15:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18  6:09 [Bug c++/95735] New: ICE on invalid non-type template argument johelegp at gmail dot com
2020-06-18  7:40 ` [Bug c++/95735] " marxin at gcc dot gnu.org
2020-06-18 13:33 ` mpolacek at gcc dot gnu.org
2020-06-18 15:11 ` mpolacek at gcc dot gnu.org
2020-06-18 15:51 ` cvs-commit at gcc dot gnu.org
2020-06-18 15:52 ` mpolacek 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).