brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · d27f0f8 Raw
71 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify2 3namespace type4{5  template<typename T>6  concept C1 = true;7 8  template<C1 T, C1 U = int>9  using A = T[10];10 11  using a = A<int>;12 13  namespace ns {14    template<typename T, int a = 0>15    concept C2 = true;16  }17 18  template<ns::C2 T1, ::type::ns::C2 T2> requires (sizeof(T1) <= sizeof(T2))19  struct B { };20 21  using b = B<int, int>;22 23  template<ns::C2... T1>24  struct C { };25 26  using c1 = C<char, char, char>;27  using c2 = C<char, char, char, char>;28}29 30namespace non_type31{32  template<int v>33  concept C1 = true;34 35  template<C1 v, C1 u = 0> // expected-error{{expected a type}} // expected-note{{declared here}}36  // expected-error@-1 2{{concept named in type constraint is not a type concept}}37  // expected-error@-2 {{expected ',' or '>' in template-parameter-list}}38  int A = v; // expected-error{{'v' does not refer to a value}}39}40 41namespace temp42{43  template<typename>44  struct test1 { }; // expected-note{{template is declared here}}45 46  template<template<typename> typename T>47  concept C1 = true;48 49  template<C1 TT, C1 UU = test1> // expected-error{{use of class template 'test1' requires template arguments}}50  // expected-error@-1 2{{concept named in type constraint is not a type concept}}51  using A = TT<int>; // expected-error{{expected ';' after alias declaration}}52}53 54namespace PR67235 {55 56template <class T>57concept C = true;58 59template <auto D>60struct S {};61 62// Don't destroy annotation 'C' at the end of the lambda; else we'll run into a63// use-after-free bug while constructing the type constraint 'C' on 'Default'.64template <typename Ret, C Default = decltype([] { return Ret(); })>65void func() {}66 67template <typename Ret, C Default = S<[] { return Ret(); }>>68void func2() {}69 70}71