Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/pr51150.C

raw
1 // PR c++/51150
2 // { dg-do compile { target c++11 } }
3
4 struct Clock {
5 double Now();
6 };
7 template <class T> void Foo(Clock* clock) {
8 const int now = clock->Now();
9 }
10
11 template void Foo<float>(Clock*);
12
13 template <class T> void Boo(int val) {
14 const int now1 = (double)(val);
15 const int now2 = const_cast<double>(val); // { dg-error "invalid" }
16 const int now3 = static_cast<double>(val);
17 const int now4 = reinterpret_cast<double>(val); // { dg-error "invalid" }
18 }
19
20 template void Boo<float>(int);