public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108254] New: Usage of requires expression with an immedietely invoked lambda expression results in compile error instead of evaluating to false
@ 2022-12-30 19:18 avr5309 at gmail dot com
2023-01-03 18:27 ` [Bug c++/108254] " ppalka at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: avr5309 at gmail dot com @ 2022-12-30 19:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108254
Bug ID: 108254
Summary: Usage of requires expression with an immedietely
invoked lambda expression results in compile error
instead of evaluating to false
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: avr5309 at gmail dot com
Target Milestone: ---
Substitution failure of an immedietely invoked lambda expression within an
requires expression results in a compile error instead of the requires
expression evaluating to 'false' (by my understanding of
http://eel.is/c++draft/expr.prim.req#general-5 . Clang 15 comforms to my
expectation).
### SOURCE:
The single source file (bug.cpp):-
template <class T>
concept Container = requires(T t) {
{
[](T const& t){
for(auto&& v : t)
;
}(t)
};
};
int main() {
static_assert(!Container<int>);
}
### COMPILER INVOCATION:
g++ -fsyntax-only -std=c++20 -Wall -Wextra -pedantic-errors -xc++ -
### ACTUAL OUTPUT:
The following error message:-
bug.cpp: In lambda function:
bug.cpp:5:13: error: 'begin' was not declared in this scope
5 | for(auto&& v : t)
| ^~~
bug.cpp:5:13: error: 'end' was not declared in this scope
bug.cpp: In function 'int main()':
bug.cpp:12:19: error: static assertion failed
12 | static_assert(!Container<int>);
| ^~~~~~~~~~~~~~~
### EXPECTED OUTPUT:
(clean compile)
### COMPILER VERSION INFO (g++ -v):
Reading specs from /usr/lib64/gcc/x86_64-unknown-linux-gnu/12.2.0/specs
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-unknown-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /builddir/gcc-12.2.0/configure
--build=x86_64-unknown-linux-gnu --enable-gnu-unique-object
--enable-vtable-verify --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --libexecdir=/usr/lib64 --libdir=/usr/lib64
--enable-threads=posix --enable-__cxa_atexit --disable-multilib
--with-system-zlib --enable-shared --enable-lto --enable-plugins
--enable-linker-build-id --disable-werror --disable-nls --enable-default-pie
--enable-default-ssp --enable-checking=release --disable-libstdcxx-pch
--with-isl --with-linker-hash-style=gnu --disable-sjlj-exceptions
--disable-target-libiberty
--enable-languages=c,c++,objc,obj-c++,fortran,lto,go,ada
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/108254] Usage of requires expression with an immedietely invoked lambda expression results in compile error instead of evaluating to false
2022-12-30 19:18 [Bug c++/108254] New: Usage of requires expression with an immedietely invoked lambda expression results in compile error instead of evaluating to false avr5309 at gmail dot com
@ 2023-01-03 18:27 ` ppalka at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-01-03 18:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108254
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Thanks for the bug report. I believe this is a dup of PR103760, and GCC is
correct to reject the program according to the current wording/intent of the
standard.
*** This bug has been marked as a duplicate of bug 103760 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-03 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-30 19:18 [Bug c++/108254] New: Usage of requires expression with an immedietely invoked lambda expression results in compile error instead of evaluating to false avr5309 at gmail dot com
2023-01-03 18:27 ` [Bug c++/108254] " 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).