1 // { dg-do compile } 2 3 class A {}; 4 class B : public A {}; 5 6 template<const A* a> class C {}; 7 template<const B* b> class D {}; 8 template<B* b> class E {}; 9 f(D<b> &,C<static_cast<const A * > (b)> &)10template<const B* b> void f(D<b> &, C<static_cast<const A*>(b)> &) {} // { dg-error "" } g(D<b> &,E<const_cast<B * > (b)> &)11template<const B* b> void g(D<b> &, E<const_cast<B*>(b)> &) {} // { dg-error "" "" { target { ! c++11 } } } 12 13 B b; 14 main()15int main() 16 { 17 C<static_cast<const A*>(&b)> c; // { dg-error "" } 18 D<&b> d; 19 E<const_cast<B*>(&b)> e; // { dg-error "" "" { target { ! c++11 } } } 20 f(d, c); // { dg-error "" "" { target c++11 } } 21 g(d, e); 22 } 23