Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

"no matching constructor" when "using" template base class constructor #38049

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR39076
Status NEW
Importance P normal
Reported by Johan Alfredsson (duvan.llvm@gmail.com)
Reported on 2018-09-25 08:47:16 -0700
Last modified on 2018-09-25 08:47:16 -0700
Version 7.0
Hardware PC Linux
CC dgregor@apple.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments bug.C (230 bytes, text/x-c++src)
Blocks
Blocked by
See also
Created attachment 20920
Small source code file to reproduce the problem.

When compiling the attached file

  bash> clang++ --std=c++17 bug.C

clang errors out with:

bug.C:14:15: error: no matching constructor for initialization of 'Sub<double>'
  Sub<double> sub(nullptr);
              ^   ~~~~~~~
bug.C:8:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'nullptr_t' to 'const Sub<double>' for 1st
argument
struct Sub : public Base<T, T> {
       ^
bug.C:8:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'nullptr_t' to 'Sub<double>' for 1st argument
struct Sub : public Base<T, T> {
       ^
bug.C:8:8: note: candidate constructor (the implicit default constructor) not
viable: requires 0 arguments, but 1 was provided
1 error generated.

It seems the base class constructor Base(double*) is not picked up despite the

  using base = Base<T, T>;
  using typename base::Base;

Works in gcc 8.2.0.
Quuxplusone commented 5 years ago

Attached bug.C (230 bytes, text/x-c++src): Small source code file to reproduce the problem.