[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / cxx2a-template-lambdas.cpp
blob65baf29718f0699fc0f7aadb611c209bbd7f466d
1 // RUN: %clang_cc1 -std=c++2a -verify %s
3 template<typename, typename>
4 constexpr bool is_same = false;
6 template<typename T>
7 constexpr bool is_same<T, T> = true;
9 template<typename T>
10 struct DummyTemplate { };
12 void func() {
13 auto L0 = []<typename T>(T arg) {
14 static_assert(is_same<T, int>); // expected-error {{static assertion failed}}
16 L0(0);
17 L0(0.0); // expected-note {{in instantiation}}
19 auto L1 = []<int I> {
20 static_assert(I == 5); // expected-error {{static assertion failed}}
22 L1.operator()<5>();
23 L1.operator()<6>(); // expected-note {{in instantiation}}
25 auto L2 = []<template<typename> class T, class U>(T<U> &&arg) {
26 static_assert(is_same<T<U>, DummyTemplate<float>>); // // expected-error {{static assertion failed}}
28 L2(DummyTemplate<float>());
29 L2(DummyTemplate<double>()); // expected-note {{in instantiation}}
32 template<typename T> // expected-note {{declared here}}
33 struct ShadowMe {
34 void member_func() {
35 auto L = []<typename T> { }; // expected-error {{'T' shadows template parameter}}
39 template<typename T>
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}}
44 static_assert(outer<int>() == 123);
45 template int *outer<int *>(); // expected-note {{in instantiation}}