The following will not compile on GCC 4.8.1:
//struct Tag {}; // Program compiles if I use this.
template <typename T>
struct Base {
struct Tag {};
Base(Tag) {}
};
template <typename T>
struct Derived : Base<T> {
Derived(Tag tag) : Base<T>(tag) {}
// Derived(Base<T>::Tag tag) : Base<T>(tag) {}
};
int main() {}
complaining [Error] expected ')' before 'tag'. It compiles on Visual Studio 2013 though, and I wanted to know if VS2013 is correct in accepting it. It does compile when I declare Tag
outside of Base<T>
, but I want to declare Tag
inside of Base<T>
where it belongs. Using Derived(Base<T>::Tag tag) : Base<T>(tag) {}
didn't help either. Any way to fix the above so that both compilers accept this, while keeping Tag
inside of Base<T>
.