111
|
1 // PR c++/54323
|
|
2 // { dg-do compile { target c++11 } }
|
|
3
|
|
4 template<bool, typename T = void>
|
|
5 struct enable_if { };
|
|
6
|
|
7 template<typename T>
|
|
8 struct enable_if<true, T>
|
|
9 { typedef T type; };
|
|
10
|
|
11 template<template<typename> class CRTP, typename T>
|
|
12 class Base
|
|
13 {
|
|
14 public:
|
|
15 template<template<typename> class CRTP0, typename T0, class>
|
|
16 friend int func(const Base<CRTP0, T0>& rhs);
|
|
17
|
|
18 protected:
|
|
19 int n;
|
|
20 };
|
|
21
|
|
22 template<template<typename> class CRTP0, typename T0,
|
|
23 class = typename enable_if<true>::type>
|
|
24 int func(const Base<CRTP0, T0>& rhs)
|
|
25 {
|
|
26 return rhs.n;
|
|
27 }
|
|
28
|
|
29 template<typename T>
|
|
30 class Derived : public Base<Derived, T> {};
|
|
31
|
|
32 int main()
|
|
33 {
|
|
34 Derived<int> x;
|
|
35 func(x);
|
|
36 return 0;
|
|
37 }
|