aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/debug/pr70271.C
blob: 3c96d3a49e910c023a146f2745f74118397f4e24 (plain)
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
35
36
// { dg-do compile }

template <typename Function>
struct function_traits
: public function_traits<decltype(&Function::operator())> 
{ };

template <typename ClassType, typename ReturnType, typename... Args>
struct function_traits<ReturnType(ClassType::*)(Args...) const> 
{
  typedef ReturnType (*pointer)(Args...);
  typedef ReturnType return_type;
};

template <typename Function>
typename function_traits<Function>::pointer
FunctionPointer (const Function& lambda) 
{
  return static_cast<typename function_traits<Function>::pointer>(lambda);
}

template <typename Function>
typename function_traits<Function>::return_type
GetReturnValue (Function func) 
{
  typename function_traits<Function>::return_type *dummy;
  return *dummy;
}
template <typename T> class ClassFoo {};
template <typename T> void FuncBar () { }

template <> inline void FuncBar<double> ()
{
  typedef void (*func_type)(ClassFoo<double> &);
  func_type f1 = FunctionPointer ([](ClassFoo<double> & ref) { });
}