Skip to content

Instantly share code, notes, and snippets.

@dgodfrey206
Last active August 29, 2015 14:19
Show Gist options
  • Save dgodfrey206/2b9d59207aa8881bfed4 to your computer and use it in GitHub Desktop.
Save dgodfrey206/2b9d59207aa8881bfed4 to your computer and use it in GitHub Desktop.
GCC bug with using-declaration
struct Base {
Base(int) {}
};
struct D1 : virtual Base {
using Base::Base;
};
int main() {
static_assert(std::is_constructible<D1, int>::value, ""); // FAILS
}
@dgodfrey206
Copy link
Author

There seems to be a bug in gcc where a using-declaration in a class D1 inheriting the constructors of a virtual base class Base implicitly odr-uses Base's default constructor. This shouldn't be the case unless a most derived class calls the constructor of Base, in which case D1 then calls Base's default-constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment