public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96959] New: GCC allows ill-formed explicit capture of requires-expression local parameter
@ 2020-09-07 18:11 hstong at ca dot ibm.com
  2020-09-11 13:35 ` [Bug c++/96959] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: hstong at ca dot ibm.com @ 2020-09-07 18:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96959
           Summary: GCC allows ill-formed explicit capture of
                    requires-expression local parameter
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

A local parameter of a requires-expression is not a local entity (the name is
not introduced into a block scope and is, therefore, not a variable with
automatic storage duration). It is required that a simple-capture names a local
entity.

GCC appears to accept simple-captures that name local parameters of
requires-expressions.

Note: Even the IFNDR interpretation of this should not consider the concept to
be satisfied.

### SOURCE (<stdin>):
template <typename, typename> concept C0 = true;

template <typename T>
concept C =
requires(T t) {
  [t] { };
};

static_assert(C<int>);


### COMPILER INVOCATION:
g++ -fsyntax-only -std=c++20 -Wall -Wextra -pedantic-errors -xc++ -


### ACTUAL OUTPUT:
(clean compile)


### EXPECTED OUTPUT:
(error diagnostic)


### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls --enable-lto
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200906 (experimental) (GCC)

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

* [Bug c++/96959] GCC allows ill-formed explicit capture of requires-expression local parameter
  2020-09-07 18:11 [Bug c++/96959] New: GCC allows ill-formed explicit capture of requires-expression local parameter hstong at ca dot ibm.com
@ 2020-09-11 13:35 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-09-11 13:35 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2020-09-11
     Ever confirmed|0                           |1

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

end of thread, other threads:[~2020-09-11 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 18:11 [Bug c++/96959] New: GCC allows ill-formed explicit capture of requires-expression local parameter hstong at ca dot ibm.com
2020-09-11 13:35 ` [Bug c++/96959] " 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).