| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-fipa-pure-const -std=c++11" } |
| 3 |
|
| 4 |
namespace std { |
| 5 |
class type_info { |
| 6 |
public: |
| 7 |
bool operator==(type_info); |
| 8 |
}; |
| 9 |
class c { |
| 10 |
public: |
| 11 |
c(int) {} |
| 12 |
type_info b; |
| 13 |
virtual void *d() { |
| 14 |
if (b == typeid(int)) |
| 15 |
return e(); |
| 16 |
return nullptr; |
| 17 |
} |
| 18 |
int *e() noexcept; |
| 19 |
}; |
| 20 |
class h { |
| 21 |
public: |
| 22 |
template <typename g, typename f> h(g, f j) { new c(j); } |
| 23 |
}; |
| 24 |
class k { |
| 25 |
protected: |
| 26 |
int n; |
| 27 |
k() : i(0, n) {} |
| 28 |
h i; |
| 29 |
}; |
| 30 |
class F : k { |
| 31 |
public: |
| 32 |
F(int, int) {} |
| 33 |
template <typename, typename f, typename...> friend F l(const f &); |
| 34 |
}; |
| 35 |
template <typename, typename f, typename...> F l(const f &p1) { F x(int(), p1); return x; } |
| 36 |
template <typename> F m() { l<int>(int()); return F(0, 0); } |
| 37 |
class D { |
| 38 |
F p; |
| 39 |
|
| 40 |
public: |
| 41 |
D() : p(m<int>()) {} |
| 42 |
}; |
| 43 |
} // namespace std |
| 44 |
std::D a; |