public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96830] New: GCC does not complain template-head containing requires clause
@ 2020-08-28  8:39 p.hyundeok76 at gmail dot com
  2020-08-28 11:13 ` [Bug c++/96830] " redi at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: p.hyundeok76 at gmail dot com @ 2020-08-28  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96830
           Summary: GCC does not complain template-head containing
                    requires clause
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: p.hyundeok76 at gmail dot com
  Target Milestone: ---

Created attachment 49145
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49145&action=edit
output of g++-10 -v -save-temps -std=c++2a test.cpp

Summary

When the member of a class template containing requires clause is defined
outside the class, the code compiles although the definition does not specify
the requires clause.

Consider the code snippet below:

template<typename Container>
    requires std::integral<typename Container::value_type>
class Foo {
public:
    void func();
};

template<typename Container>
void Foo<Container>::func()
{}

As shown above, the definition of Foo<T>::func does not contain requires
clause. But it compiles without an error.

When compiled with clang, it complains.

- version of GCC (tested on two machines)
1.
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-offload-targets=nvptx-none,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)

2.
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)

- system (output of uname -a excluding dates)
1. 4.4.0-18362-Microsoft #836-Microsoft x86_64 x86_64 x86_64 GNU/Linux
2. Linux arch 5.8.3-arch1-1 x86_64 GNU/Linux

- options used for compilation
-std=c++2a

- command line that triggers the bug
g++ -std=c++2a test.cpp

- compiler output
Nothing

- preprocessed file (generated on the first system)
test.ii

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

end of thread, other threads:[~2023-04-27 23:04 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28  8:39 [Bug c++/96830] New: GCC does not complain template-head containing requires clause p.hyundeok76 at gmail dot com
2020-08-28 11:13 ` [Bug c++/96830] " redi at gcc dot gnu.org
2020-08-28 11:24 ` redi at gcc dot gnu.org
2020-08-28 11:26 ` redi at gcc dot gnu.org
2022-07-20  9:54 ` redi at gcc dot gnu.org
2022-07-20 22:59 ` [Bug c++/96830] GCC does not complain about redeclaration with inconsistent " cvs-commit at gcc dot gnu.org
2022-07-21 11:17 ` cvs-commit at gcc dot gnu.org
2022-07-22  7:07 ` cvs-commit at gcc dot gnu.org
2022-10-02  6:59 ` oschonrock at gmail dot com
2022-10-02 18:43 ` redi at gcc dot gnu.org
2022-10-02 18:46 ` redi at gcc dot gnu.org
2022-10-03 13:58 ` redi at gcc dot gnu.org
2022-10-31 16:57 ` ppalka at gcc dot gnu.org
2023-03-13 20:40 ` ppalka at gcc dot gnu.org
2023-03-14 23:18 ` cvs-commit at gcc dot gnu.org
2023-03-14 23:18 ` cvs-commit at gcc dot gnu.org
2023-03-14 23:28 ` ppalka at gcc dot gnu.org
2023-04-27 23:04 ` cvs-commit 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).