tree-optimization/116481 - avoid building function_type[]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / pr83406.C
blobc348968edc3b42f6496beecf82f0e0c3df131509
1 // { dg-do compile { target c++14 } }
2 // PR 83406, lambda late returns are not the same as missing returns
4 class Bar
6 public:
7   const int& getter() const;
8   int& getter();
9 };
11 auto one = [](const Bar& bar) -> decltype(auto)
13   return bar.getter();
16 auto two = [](const Bar& bar) -> auto
18   return bar.getter();
21 auto three = [](const Bar& bar)
23   return bar.getter();
26 template <typename T, typename U> struct X 
28   static const bool same = false;
31 template <typename T> struct X<T,T>
33   static const bool same = true;
36 void frob (Bar &x)
38   static_assert (X<const int &, decltype (one (x))>::same, "not const int &");
39   static_assert (X<int, decltype (two (x))>::same, "not int");
40   static_assert (X<int, decltype (three (x))>::same, "not int");