1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
struct Baz {};
struct Qux {};
struct Base {
virtual ~Base() {}
virtual void foo() = 0;
};
template<typename T> struct Identity { static bool const value = false; };
template<typename T> void bar(T) { static_assert(Identity<T>::value, "Busted!!!"); }
template<> void bar<Baz>(Baz) {}
template<typename T>
struct Derived : Base {
T m;
void foo() override = 0 ;//{ bar(m); }
};
template<typename T>
void Derived<T>::foo() {
bar(m);
}
struct Derived2 : Derived<Qux> {};
int main() {
//Base *b0 = new Derived<Baz>;
//b0->foo();
//Derived<Qux> d1;
//Base *b1 = new Derived<Qux>;
//(void) b1;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
g++ -std=c++14 -Wall -pedantic-errors main.cpp && ./a.out