[lldb] Fix warning: 'sprintf' is deprecated in RNBSocketTest
[llvm-project.git] / clang / test / CXX / expr / expr.prim / expr.prim.lambda / p18.cpp
blob72cf93be5190f5e71afd8c47e16c6a093bf1cd68
1 // RUN: %clang_cc1 -std=c++11 %s -Wunused -Wno-unused-lambda-capture -verify
2 // expected-no-diagnostics
4 template<typename T, typename U>
5 struct is_same {
6 static const bool value = false;
7 };
9 template<typename T>
10 struct is_same<T, T> {
11 static const bool value = true;
14 void f3() {
15 float x, &r = x;
16 int i;
17 int &ir = i;
18 const int &irc = i;
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 }();
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 }();
43 [&i] {
44 static_assert(is_same<decltype((i)), int&>::value, "should be int&");
45 }();