1 // RUN: %clang_cc1 -std=c++2a -verify %s
2 
3 template<typename, typename>
4 constexpr bool is_same = false;
5 
6 template<typename T>
7 constexpr bool is_same<T, T> = true;
8 
9 template<typename T>
10 struct DummyTemplate { };
11 
func()12 void func() {
13   auto L0 = []<typename T>(T arg) {
14     static_assert(is_same<T, int>); // expected-error {{static_assert failed}}
15   };
16   L0(0);
17   L0(0.0); // expected-note {{in instantiation}}
18 
19   auto L1 = []<int I> {
20     static_assert(I == 5); // expected-error {{static_assert failed}}
21   };
22   L1.operator()<5>();
23   L1.operator()<6>(); // expected-note {{in instantiation}}
24 
25   auto L2 = []<template<typename> class T, class U>(T<U> &&arg) {
26     static_assert(is_same<T<U>, DummyTemplate<float>>); // // expected-error {{static_assert failed}}
27   };
28   L2(DummyTemplate<float>());
29   L2(DummyTemplate<double>()); // expected-note {{in instantiation}}
30 }
31 
32 template<typename T> // expected-note {{declared here}}
33 struct ShadowMe {
member_funcShadowMe34   void member_func() {
35     auto L = []<typename T> { }; // expected-error {{'T' shadows template parameter}}
36   }
37 };
38 
39 template<typename T>
outer()40 constexpr T outer() {
41   return []<T x>() { return x; }.template operator()<123>(); // expected-error {{no matching member function}} \
42                                                                 expected-note {{candidate template ignored}}
43 }
44 static_assert(outer<int>() == 123);
45 template int *outer<int *>(); // expected-note {{in instantiation}}
46