https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107188
Bug ID: 107188 Summary: using concept type-constraint declared in nested namespace causes incorrect compilation error Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Mark_B53 at yahoo dot com Target Milestone: --- #include <concepts> #include <ranges> #include <vector> namespace ns1 { template <typename T, typename V> concept RangeV = std::ranges::range<T> && std::same_as<std::ranges::range_value_t<T>, V>; } namespace ns2 { ns1::RangeV<int> auto fn() { return std::vector<int>{}; } // compiles struct X { ns1::RangeV<int> auto fn() { return std::vector<int>{}; } // fails to compile (bug!) }; using ns1::RangeV; struct Y { RangeV<int> auto fn() { return std::vector<int>{}; } // compiles }; } ----- <source>:11:10: error: wrong number of template arguments (1, should be 2) 11 | ns1::RangeV<int> auto fn() { return std::vector<int>{}; } // fails to compile (bug!) | ^~~~~~~~~~~ <source>:6:9: note: provided for 'template<class T, class V> concept ns1::RangeV' 6 | concept RangeV = std::ranges::range<T> && std::same_as<std::ranges::range_value_t<T>, V>; ----- g++ a.cpp -std=c++20 Using built-in specs. COLLECT_GCC=/opt/compiler-explorer/gcc-snapshot/bin/g++ Target: x86_64-linux-gnu Configured with: ../gcc-trunk-20221008/configure --prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap --enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,objc,obj-c++,d --enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix --with-pkgversion=Compiler-Explorer-Build-gcc-895dd027d5dda51a95d242aec8a49a6dfa5db58d-binutils-2.38 --enable-libstdcxx-backtrace=yes Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20221007 (experimental) (Compiler-Explorer-Build-gcc-895dd027d5dda51a95d242aec8a49a6dfa5db58d-binutils-2.38) COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' '/app/output.s' '-masm=intel' '-S' '-v' '-std=c++20' '-isystem' '/opt/compiler-explorer/libs/boost_1_80_0' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' '/app/' /opt/compiler-explorer/gcc-trunk-20221008/bin/../libexec/gcc/x86_64-linux-gnu/13.0.0/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -iprefix /opt/compiler-explorer/gcc-trunk-20221008/bin/../lib/gcc/x86_64-linux-gnu/13.0.0/ -D_GNU_SOURCE -isystem /opt/compiler-explorer/libs/boost_1_80_0 <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext .cpp -masm=intel -mtune=generic -march=x86-64 -g -std=c++20 -version -fdiagnostics-color=always -o /app/output.s GNU C++20 (Compiler-Explorer-Build-gcc-895dd027d5dda51a95d242aec8a49a6dfa5db58d-binutils-2.38) version 13.0.0 20221007 (experimental) (x86_64-linux-gnu) compiled by GNU C version 9.4.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP