[Bug c++/83130] Compilation error related to 'using', template instantiations and default constructors

2017-11-23 Thread nadult at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83130

--- Comment #1 from Krzysztof Jakubowski  ---
someFunc() at the bottom is unnecessary.

[Bug c++/83130] New: Compilation error related to 'using', template instantiations and default constructors

2017-11-23 Thread nadult at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83130

Bug ID: 83130
   Summary: Compilation error related to 'using', template
instantiations and default constructors
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: nadult at fastmail dot fm
  Target Milestone: ---

The following code fails to compile on new GCC (7.1, 7.2, 8.0). It compiles
without any problems on Clang. Compiled with: -std=c++1z

#include 

template  struct ValueBase {
ValueBase() {}
ValueBase(const ValueBase ) {}
ValueBase(ValueBase &) {}
void operator=(ValueBase &) {}
void operator=(const ValueBase ) {}
};

template  struct Value : public ValueBase {
Value(void *) {}
using ValueBase::ValueBase;
using ValueBase::operator=;
};

struct MyObj {
MyObj();
MyObj(const MyObj &);

struct Impl {
// Uncomment these lines to make the bug go away:
//Impl() = default;
//Impl(const Impl &) = default;

Value value;
};

std::pair<Impl, Impl> pair;
};

MyObj::MyObj(const MyObj &) = default;

void someFunc() {
std::pair<MyObj::Impl, MyObj::Impl> impl;
// Comment this line to make the bug go away
impl.first.value = nullptr;
}