1 | // RUN: %clang_cc1 -std=c++11 %s -Wunused -Wno-unused-lambda-capture -verify |
2 | // expected-no-diagnostics |
3 | |
4 | template<typename T, typename U> |
5 | struct is_same { |
6 | static const bool value = false; |
7 | }; |
8 | |
9 | template<typename T> |
10 | struct is_same<T, T> { |
11 | static const bool value = true; |
12 | }; |
13 | |
14 | void f3() { |
15 | float x, &r = x; |
16 | int i; |
17 | int &ir = i; |
18 | const int &irc = i; |
19 | |
20 | [=,&irc,&ir] { |
21 | static_assert(is_same<decltype(((r))), float const&>::value, |
22 | "should be const float&"); |
23 | static_assert(is_same<decltype(x), float>::value, "should be float"); |
24 | static_assert(is_same<decltype((x)), const float&>::value, |
25 | "should be const float&"); |
26 | static_assert(is_same<decltype(r), float&>::value, "should be float&"); |
27 | static_assert(is_same<decltype(ir), int&>::value, "should be int&"); |
28 | static_assert(is_same<decltype((ir)), int&>::value, "should be int&"); |
29 | static_assert(is_same<decltype(irc), const int&>::value, |
30 | "should be const int&"); |
31 | static_assert(is_same<decltype((irc)), const int&>::value, |
32 | "should be const int&"); |
33 | }(); |
34 | |
35 | [=] { |
36 | [=] () mutable { |
37 | static_assert(is_same<decltype(x), float>::value, "should be float"); |
38 | static_assert(is_same<decltype((x)), float&>::value, |
39 | "should be float&"); |
40 | }(); |
41 | }(); |
42 | |
43 | [&i] { |
44 | static_assert(is_same<decltype((i)), int&>::value, "should be int&"); |
45 | }(); |
46 | } |
47 | |