public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108570] New: [concept] GCC tries to instantiate additional unneeded operator.
@ 2023-01-27 9:49 fsb4000 at yandex dot ru
2023-01-27 17:02 ` [Bug c++/108570] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: fsb4000 at yandex dot ru @ 2023-01-27 9:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108570
Bug ID: 108570
Summary: [concept] GCC tries to instantiate additional unneeded
operator.
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fsb4000 at yandex dot ru
Target Milestone: ---
Hello!
Look at the code:
```c++
template <class T>
concept Foo = requires(T val) {
val == val;
};
template <class T>
struct Bar {};
template <class T>
bool operator==(const Bar<T>&, const Bar<T>&);
template <class T>
requires Foo<Bar<T>>
bool operator==(const Bar<T>&, int);
static_assert(Foo<Bar<int>>);
```
$ g++ -std=c++20 test.cpp
test.cpp: In substitution of 'template<class T> requires Foo<Bar<T> > bool
operator==(const Bar<T>&, int) [with T = int]':
test.cpp:3:7: required from here
test.cpp:2:9: required for the satisfaction of 'Foo<Bar<T> >' [with T = int]
test.cpp:2:15: in requirements with 'T val' [with T = Bar<int>]
test.cpp:2:15: error: satisfaction of atomic constraint 'requires(T val) {val
== val;} [with T = Bar<int>]' depends on itself
2 | concept Foo = requires(T val) {
| ^~~~~~~~~~~~~~~~~
3 | val == val;
| ~~~~~~~~~~~
4 | };
| ~
test.cpp: In substitution of 'template<class T> requires Foo<Bar<T> > bool
operator==(const Bar<T>&, int) [with T = int]':
test.cpp:3:7: required from here
test.cpp:2:9: required for the satisfaction of 'Foo<Bar<T> >' [with T = int]
test.cpp:2:15: in requirements with 'T val' [with T = Bar<int>]
test.cpp:2:15: error: satisfaction of atomic constraint 'requires(T val) {val
== val;} [with T = Bar<int>]' depends on itself
$ g++ -v
Using built-in specs.
COLLECT_GCC=C:\tools\msys64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-12.2.0/configure --prefix=/mingw64
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/mingw64/include --libexecdir=/mingw64/lib
--enable-bootstrap --enable-checking=release --with-arch=x86-64
--with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit
--enable-shared --enable-static --enable-libatomic --enable-threads=posix
--enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-filesystem-ts --enable-libstdcxx-time
--disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-multilib
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64
--with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64
--with-pkgversion='Rev1, Built by MSYS2 project'
--with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as
--with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++
--with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Rev1, Built by MSYS2 project
MSVC and clang++ can compile the code.
Do you think this is GCC bug or MSVC and clang++ are too permissive?
Found by hui.xie1990@gmail.com and varconst@apple.com while implementing
zip_iterator
Godbolt link: https://godbolt.org/z/ff41PE9KG
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/108570] [concept] GCC tries to instantiate additional unneeded operator.
2023-01-27 9:49 [Bug c++/108570] New: [concept] GCC tries to instantiate additional unneeded operator fsb4000 at yandex dot ru
@ 2023-01-27 17:02 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-27 17:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108570
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 108393.
*** This bug has been marked as a duplicate of bug 108393 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-27 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 9:49 [Bug c++/108570] New: [concept] GCC tries to instantiate additional unneeded operator fsb4000 at yandex dot ru
2023-01-27 17:02 ` [Bug c++/108570] " pinskia 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).