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

            Bug ID: 94549
           Summary: [10 Regression] Inherited and constrained constructors
                    are "ambiguous" even if they aren't
           Product: gcc
           Version: c++-concepts
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
  Target Milestone: ---

The following code worked until gcc 10:

```c++
struct base {
  template <typename type>
    requires false
  base(type);

  template <typename type>
    requires true
  base(type);
};

struct derived : base {
  using base::base;
};

int main() { derived{'G'}; }
```

All other major compilers supporting concepts accept this example, see
https://godbolt.org/z/cabrpc

but gcc10 produces 

```
> g++-git -std=c++2a ice.cpp       

ice.cpp: In function ‘int main()’:
ice.cpp:15:25: error: call of overloaded ‘derived(<brace-enclosed initializer
list>)’ is ambiguous
   15 | int main() { derived{'G'}; }
      |                         ^
ice.cpp:4:3: note: candidate: ‘base::base(type)’
    4 |   base(type);
      |   ^~~~
ice.cpp:12:15: note:   inherited here
   12 |   using base::base;
      |               ^~~~
ice.cpp:8:3: note: candidate: ‘base::base(type)’
    8 |   base(type);
      |   ^~~~
ice.cpp:12:15: note:   inherited here
   12 |   using base::base;
      |               ^~~~
ice.cpp:11:8: note: candidate: ‘constexpr derived::derived(const derived&)’
   11 | struct derived : base {
      |        ^~~~~~~
ice.cpp:11:8: note: candidate: ‘constexpr derived::derived(derived&&)’
```

My gcc version is

```
> g++-git -v       

Using built-in specs.
COLLECT_GCC=g++-git
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-git/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/marehr/Packages/gcc-git/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++ --enable-shared --enable-threads=posix
--with-system-zlib --with-isl --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib
--disable-werror --enable-checking=release --enable-default-pie
--enable-default-ssp --enable-cet=auto --disable-boostrap
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.1 20200326 (experimental) (GCC)
```

Reply via email to