[Bug c++/96959] New: GCC allows ill-formed explicit capture of requires-expression local parameter
hstong at ca dot ibm.com
gcc-bugzilla@gcc.gnu.org
Mon Sep 7 18:11:27 GMT 2020
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)
More information about the Gcc-bugs
mailing list