Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / SemaCXX / GH83461.cpp
blob509535e883e6d9d53d56cc3d66b8017265838246
1 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
3 struct S {
4 template<typename Ty = int>
5 friend void foo(auto){}
7 template<typename Ty = int, typename Tz>
8 friend void foo2(){}
9 };
11 template<typename T>
12 struct TemplS {
13 template<typename Ty = int>
14 friend void foo3(auto){}
16 template<typename Ty = int, typename Tz>
17 friend void foo4(){}
20 void Inst() {
21 TemplS<int>();
23 // expected-error@+2{{template parameter missing a default argument}}
24 // expected-note@+1{{previous default template argument defined here}}
25 template<typename T = int, typename U>
26 struct ClassTempl{};
28 struct HasFriendClassTempl {
29 // expected-error@+1{{default template argument not permitted on a friend template}}
30 template<typename T = int, typename U>
31 friend struct Friend;
33 // expected-error@+3{{cannot define a type in a friend declaration}}
34 // expected-error@+1{{default template argument not permitted on a friend template}}
35 template<typename T = int, typename U>
36 friend struct Friend2{};
39 template<typename Ty>
40 struct HasFriendClassTempl2 {
41 // expected-error@+3{{template parameter missing a default argument}}
42 // expected-note@+2{{previous default template argument defined here}}
43 // expected-note@#INST2{{in instantiation of template class}}
44 template<typename T = int, typename U>
45 friend struct Friend;
48 void Inst2() {
49 HasFriendClassTempl2<int>(); // #INST2
52 // expected-error@+2{{template parameter missing a default argument}}
53 // expected-note@+1{{previous default template argument defined here}}
54 template<typename T = int, typename U>
55 static constexpr U VarTempl;
57 // expected-error@+2{{template parameter missing a default argument}}
58 // expected-note@+1{{previous default template argument defined here}}
59 template<typename T = int, typename U>
60 using TypeAlias = U;