Skip to content

Commit 3cfe7da

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:b6a4ab5a12c9ced0642769e4b2d8f77859541ba8 into amd-gfx:6ab9923b43c0
Local branch amd-gfx 6ab9923 Merged main:357bd61744bb8cc2b9b07447294fa977e5758550 into amd-gfx:4cb01f455ead Remote branch main b6a4ab5 [NFC] Fix llvm#106873 - update assignment tracking docs (llvm#106959)
2 parents 6ab9923 + b6a4ab5 commit 3cfe7da

File tree

174 files changed

+10986
-4830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+10986
-4830
lines changed

clang-tools-extra/clangd/TidyFastChecks.inc

Lines changed: 367 additions & 302 deletions
Large diffs are not rendered by default.

clang-tools-extra/include-cleaner/lib/WalkAST.cpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "clang/AST/DeclTemplate.h"
1616
#include "clang/AST/Expr.h"
1717
#include "clang/AST/ExprCXX.h"
18+
#include "clang/AST/NestedNameSpecifier.h"
1819
#include "clang/AST/RecursiveASTVisitor.h"
1920
#include "clang/AST/TemplateBase.h"
2021
#include "clang/AST/TemplateName.h"
@@ -23,9 +24,11 @@
2324
#include "clang/Basic/IdentifierTable.h"
2425
#include "clang/Basic/SourceLocation.h"
2526
#include "clang/Basic/Specifiers.h"
27+
#include "llvm/ADT/STLExtras.h"
2628
#include "llvm/ADT/STLFunctionalExtras.h"
2729
#include "llvm/ADT/SmallVector.h"
2830
#include "llvm/Support/Casting.h"
31+
#include "llvm/Support/ErrorHandling.h"
2932

3033
namespace clang::include_cleaner {
3134
namespace {
@@ -125,6 +128,24 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
125128
return true;
126129
}
127130

131+
bool qualifierIsNamespaceOrNone(DeclRefExpr *DRE) {
132+
const auto *Qual = DRE->getQualifier();
133+
if (!Qual)
134+
return true;
135+
switch (Qual->getKind()) {
136+
case NestedNameSpecifier::Namespace:
137+
case NestedNameSpecifier::NamespaceAlias:
138+
case NestedNameSpecifier::Global:
139+
return true;
140+
case NestedNameSpecifier::TypeSpec:
141+
case NestedNameSpecifier::TypeSpecWithTemplate:
142+
case NestedNameSpecifier::Super:
143+
case NestedNameSpecifier::Identifier:
144+
return false;
145+
}
146+
llvm_unreachable("Unknown value for NestedNameSpecifierKind");
147+
}
148+
128149
bool VisitDeclRefExpr(DeclRefExpr *DRE) {
129150
auto *FD = DRE->getFoundDecl();
130151
// Prefer the underlying decl if FoundDecl isn't a shadow decl, e.g:
@@ -146,10 +167,8 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
146167
//
147168
// If it's an enum constant, it must be due to prior decl. Report references
148169
// to it when qualifier isn't a type.
149-
if (llvm::isa<EnumConstantDecl>(FD)) {
150-
if (!DRE->getQualifier() || DRE->getQualifier()->getAsNamespace())
151-
report(DRE->getLocation(), FD);
152-
}
170+
if (llvm::isa<EnumConstantDecl>(FD) && qualifierIsNamespaceOrNone(DRE))
171+
report(DRE->getLocation(), FD);
153172
return true;
154173
}
155174

clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,9 @@ TEST(WalkAST, Enums) {
534534
testWalk(R"(namespace ns { enum E { A = 42 }; }
535535
struct S { using ns::E::A; };)",
536536
"int e = S::^A;");
537+
testWalk(R"(namespace ns { enum E { $explicit^A = 42 }; })",
538+
"namespace z = ns; int e = z::^A;");
539+
testWalk(R"(enum E { $explicit^A = 42 };)", "int e = ::^A;");
537540
}
538541

539542
TEST(WalkAST, InitializerList) {

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ Bug Fixes to C++ Support
338338
- Fixed an assertion failure when converting vectors to int/float with invalid expressions. (#GH105486)
339339
- Template parameter names are considered in the name lookup of out-of-line class template
340340
specialization right before its declaration context. (#GH64082)
341+
- Fixed a constraint comparison bug for friend declarations. (#GH78101)
341342

342343
Bug Fixes to AST Handling
343344
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticIDs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace clang {
3939
DIAG_SIZE_AST = 300,
4040
DIAG_SIZE_COMMENT = 100,
4141
DIAG_SIZE_CROSSTU = 100,
42-
DIAG_SIZE_SEMA = 4500,
42+
DIAG_SIZE_SEMA = 5000,
4343
DIAG_SIZE_ANALYSIS = 100,
4444
DIAG_SIZE_REFACTORING = 1000,
4545
DIAG_SIZE_INSTALLAPI = 100,

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5603,7 +5603,7 @@ def note_checking_constraints_for_function_here : Note<
56035603
def note_constraint_substitution_here : Note<
56045604
"while substituting template arguments into constraint expression here">;
56055605
def note_constraint_normalization_here : Note<
5606-
"while calculating associated constraint of template '%0' here">;
5606+
"while calculating associated constraint of template %0 here">;
56075607
def note_parameter_mapping_substitution_here : Note<
56085608
"while substituting into concept arguments here; substitution failures not "
56095609
"allowed in concept arguments">;

clang/include/clang/Basic/TargetCXXABI.def

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/// many compilers, including Clang and GCC.
3030
///
3131
/// It is documented here:
32-
/// http://www.codesourcery.com/public/cxx-abi/
32+
/// http://itanium-cxx-abi.github.io/cxx-abi/
3333
ITANIUM_CXXABI(GenericItanium, "itanium")
3434

3535
/// The generic ARM ABI is a modified version of the Itanium ABI
@@ -46,8 +46,7 @@ ITANIUM_CXXABI(GenericItanium, "itanium")
4646
/// - and more!
4747
///
4848
/// It is documented here:
49-
/// http://infocenter.arm.com
50-
/// /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf
49+
/// https://github.com/ARM-software/abi-aa/blob/main/cppabi32/cppabi32.rst
5150
ITANIUM_CXXABI(GenericARM, "arm")
5251

5352
/// The iOS ABI is a partial implementation of the ARM ABI.
@@ -63,10 +62,6 @@ ITANIUM_CXXABI(iOS, "ios")
6362

6463
/// The iOS 64-bit and macOS 64-bit ARM ABI follows ARM's published 64-bit
6564
/// ABI more closely, but we don't guarantee to follow it perfectly.
66-
///
67-
/// It is documented here:
68-
/// http://infocenter.arm.com
69-
/// /help/topic/com.arm.doc.ihi0059a/IHI0059A_cppabi64.pdf
7065
ITANIUM_CXXABI(AppleARM64, "applearm64")
7166

7267
/// WatchOS is a modernisation of the iOS ABI, which roughly means it's
@@ -80,6 +75,9 @@ ITANIUM_CXXABI(WatchOS, "watchos")
8075
/// The relevant changes from the generic ABI in this case are:
8176
/// - representation of member function pointers adjusted as in ARM.
8277
/// - guard variables are smaller.
78+
///
79+
/// It is documented here:
80+
/// https://github.com/ARM-software/abi-aa/blob/main/cppabi64/cppabi64.rst
8381
ITANIUM_CXXABI(GenericAArch64, "aarch64")
8482

8583
/// The generic Mips ABI is a modified version of the Itanium ABI.

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,12 +1235,6 @@ bool Compiler<Emitter>::VisitImplicitValueInitExpr(
12351235
assert(RD);
12361236
if (RD->isInvalidDecl())
12371237
return false;
1238-
if (RD->isUnion()) {
1239-
// C++11 [dcl.init]p5: If T is a (possibly cv-qualified) union type, the
1240-
// object's first non-static named data member is zero-initialized
1241-
// FIXME
1242-
return false;
1243-
}
12441238

12451239
if (const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
12461240
CXXRD && CXXRD->getNumVBases() > 0) {
@@ -3434,6 +3428,8 @@ bool Compiler<Emitter>::visitZeroRecordInitializer(const Record *R,
34343428
if (!this->emitFinishInitPop(E))
34353429
return false;
34363430

3431+
// C++11 [dcl.init]p5: If T is a (possibly cv-qualified) union type, the
3432+
// object's first non-static named data member is zero-initialized
34373433
if (R->isUnion())
34383434
break;
34393435
}

clang/lib/AST/ByteCode/Function.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ bool Function::isVirtual() const {
6161
static bool isUnevaluatedBuiltin(unsigned BuiltinID) {
6262
return BuiltinID == Builtin::BI__builtin_classify_type ||
6363
BuiltinID == Builtin::BI__builtin_os_log_format_buffer_size ||
64-
BuiltinID == Builtin::BI__builtin_constant_p;
64+
BuiltinID == Builtin::BI__builtin_constant_p ||
65+
BuiltinID == Builtin::BI__noop;
6566
}
6667

6768
bool Function::isUnevaluatedBuiltin() const {

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
15931593
return false;
15941594
break;
15951595

1596+
case Builtin::BI__noop:
1597+
pushInteger(S, 0, Call->getType());
1598+
break;
1599+
15961600
default:
15971601
S.FFDiag(S.Current->getLocation(OpPC),
15981602
diag::note_invalid_subexpr_in_const_expr)

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12720,8 +12720,8 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1272012720
}
1272112721

1272212722
case Builtin::BI__noop:
12723-
// __noop always evaluates successfully
12724-
return true;
12723+
// __noop always evaluates successfully and returns 0.
12724+
return Success(0, E);
1272512725

1272612726
case Builtin::BI__builtin_is_constant_evaluated: {
1272712727
const auto *Callee = Info.CurrentCall->getCallee();

clang/lib/Driver/ToolChain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,8 @@ std::optional<std::string> ToolChain::getRuntimePath() const {
843843
llvm::sys::path::append(P, "lib");
844844
if (auto Ret = getTargetSubDirPath(P))
845845
return Ret;
846-
// Darwin does not use per-target runtime directory.
847-
if (Triple.isOSDarwin())
846+
// Darwin and AIX does not use per-target runtime directory.
847+
if (Triple.isOSDarwin() || Triple.isOSAIX())
848848
return {};
849849
llvm::sys::path::append(P, Triple.str());
850850
return std::string(P);

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,8 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
609609
ProbablyBracedList = NextTok->isNot(tok::l_square);
610610
}
611611

612-
// Cpp macro definition body that is a nonempty braced list or block:
612+
// Cpp macro definition body containing nonempty braced list or block:
613613
if (IsCpp && Line->InMacroBody && PrevTok != FormatTok &&
614-
!FormatTok->Previous && NextTok->is(tok::eof) &&
615614
// A statement can end with only `;` (simple statement), a block
616615
// closing brace (compound statement), or `:` (label statement).
617616
// If PrevTok is a block opening brace, Tok ends an empty block.

clang/lib/Sema/SemaConcept.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,14 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
10121012
// possible that e.g. constraints involving C<Class<T>> and C<Class> are
10131013
// perceived identical.
10141014
std::optional<Sema::ContextRAII> ContextScope;
1015-
if (auto *RD = dyn_cast<CXXRecordDecl>(DeclInfo.getDeclContext())) {
1015+
const DeclContext *DC = [&] {
1016+
if (!DeclInfo.getDecl())
1017+
return DeclInfo.getDeclContext();
1018+
return DeclInfo.getDecl()->getFriendObjectKind()
1019+
? DeclInfo.getLexicalDeclContext()
1020+
: DeclInfo.getDeclContext();
1021+
}();
1022+
if (auto *RD = dyn_cast<CXXRecordDecl>(DC)) {
10161023
ThisScope.emplace(S, const_cast<CXXRecordDecl *>(RD), Qualifiers());
10171024
ContextScope.emplace(S, const_cast<DeclContext *>(cast<DeclContext>(RD)),
10181025
/*NewThisContext=*/false);

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,8 +1226,7 @@ void Sema::PrintInstantiationStack() {
12261226
case CodeSynthesisContext::ConstraintNormalization:
12271227
Diags.Report(Active->PointOfInstantiation,
12281228
diag::note_constraint_normalization_here)
1229-
<< cast<NamedDecl>(Active->Entity)->getName()
1230-
<< Active->InstantiationRange;
1229+
<< cast<NamedDecl>(Active->Entity) << Active->InstantiationRange;
12311230
break;
12321231
case CodeSynthesisContext::ParameterMappingSubstitution:
12331232
Diags.Report(Active->PointOfInstantiation,

clang/test/AST/ByteCode/ms.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -verify=ref,both %s -fms-extensions
2-
// RUN: %clang_cc1 -verify=expected,both %s -fexperimental-new-constant-interpreter -fms-extensions
1+
// RUN: %clang_cc1 -verify=ref,both %s -fms-extensions -fcxx-exceptions
2+
// RUN: %clang_cc1 -verify=expected,both %s -fexperimental-new-constant-interpreter -fms-extensions -fcxx-exceptions
33

44
// ref-no-diagnostics
55
// expected-no-diagnostics
@@ -8,3 +8,14 @@
88
static_assert(_rotl(0x01, 5) == 32);
99

1010
static_assert(alignof(__unaligned int) == 1, "");
11+
12+
static_assert(__noop() == 0, "");
13+
14+
constexpr int noopIsActuallyNoop() {
15+
int a = 0;
16+
__noop(throw);
17+
__noop(++a);
18+
__noop(a = 100);
19+
return a;
20+
}
21+
static_assert(noopIsActuallyNoop() == 0);

clang/test/AST/ByteCode/references.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,16 @@ static_assert(testGetValue() == 30, "");
7171

7272
constexpr const int &MCE = 20;
7373
static_assert(MCE == 20, "");
74-
static_assert(MCE == 30, ""); // expected-error {{static assertion failed}} \
75-
// expected-note {{evaluates to '20 == 30'}} \
76-
// ref-error {{static assertion failed}} \
77-
// ref-note {{evaluates to '20 == 30'}}
74+
static_assert(MCE == 30, ""); // both-error {{static assertion failed}} \
75+
// both-note {{evaluates to '20 == 30'}}
7876

7977
constexpr int LocalMCE() {
8078
const int &m = 100;
8179
return m;
8280
}
8381
static_assert(LocalMCE() == 100, "");
84-
static_assert(LocalMCE() == 200, ""); // expected-error {{static assertion failed}} \
85-
// expected-note {{evaluates to '100 == 200'}} \
86-
// ref-error {{static assertion failed}} \
87-
// ref-note {{evaluates to '100 == 200'}}
82+
static_assert(LocalMCE() == 200, ""); // both-error {{static assertion failed}} \
83+
// both-note {{evaluates to '100 == 200'}}
8884

8985
struct S {
9086
int i, j;

clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ template<typename T> requires Bar2<T> struct S2 { };
1515
// expected-note@-1{{template is declared here}}
1616
template<typename T> requires Bar2<T> && true struct S2<T> { };
1717
// expected-error@-1{{class template partial specialization is not more specialized than the primary template}}
18-
// expected-note@-2{{while calculating associated constraint of template 'S2' here}}
18+
// expected-note@-2{{while calculating associated constraint of template 'S2<T>' here}}
1919

2020
namespace type_pack {
2121
template<typename... Args>

clang/test/CodeGen/attr-counted-by.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ void test6(struct anon_struct *p, int index) {
639639
p->array[index] = __builtin_dynamic_object_size(p->array, 1);
640640
}
641641

642-
// SANITIZE-WITH-ATTR-LABEL: define dso_local i64 @test6_bdos(
642+
// SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, -3) i64 @test6_bdos(
643643
// SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
644644
// SANITIZE-WITH-ATTR-NEXT: entry:
645645
// SANITIZE-WITH-ATTR-NEXT: [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
@@ -649,7 +649,7 @@ void test6(struct anon_struct *p, int index) {
649649
// SANITIZE-WITH-ATTR-NEXT: [[TMP1:%.*]] = select i1 [[DOTINV]], i64 0, i64 [[TMP0]]
650650
// SANITIZE-WITH-ATTR-NEXT: ret i64 [[TMP1]]
651651
//
652-
// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local i64 @test6_bdos(
652+
// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, -3) i64 @test6_bdos(
653653
// NO-SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
654654
// NO-SANITIZE-WITH-ATTR-NEXT: entry:
655655
// NO-SANITIZE-WITH-ATTR-NEXT: [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
@@ -955,7 +955,7 @@ void test10(struct union_of_fams *p, int index) {
955955
p->bytes[index] = (unsigned char)__builtin_dynamic_object_size(p->bytes, 1);
956956
}
957957

958-
// SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 -2147483648, 2147483648) i64 @test10_bdos(
958+
// SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, 2147483648) i64 @test10_bdos(
959959
// SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
960960
// SANITIZE-WITH-ATTR-NEXT: entry:
961961
// SANITIZE-WITH-ATTR-NEXT: [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
@@ -964,7 +964,7 @@ void test10(struct union_of_fams *p, int index) {
964964
// SANITIZE-WITH-ATTR-NEXT: [[TMP0:%.*]] = zext nneg i32 [[NARROW]] to i64
965965
// SANITIZE-WITH-ATTR-NEXT: ret i64 [[TMP0]]
966966
//
967-
// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 -2147483648, 2147483648) i64 @test10_bdos(
967+
// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local range(i64 0, 2147483648) i64 @test10_bdos(
968968
// NO-SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef readonly [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
969969
// NO-SANITIZE-WITH-ATTR-NEXT: entry:
970970
// NO-SANITIZE-WITH-ATTR-NEXT: [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 8
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Test output of -print-runtime-dir on AIX
2+
3+
// RUN: %clang -print-runtime-dir --target=powerpc-ibm-aix \
4+
// RUN: -resource-dir=%S/Inputs/resource_dir \
5+
// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
6+
7+
// RUN: %clang -print-runtime-dir --target=powerpc64-ibm-aix \
8+
// RUN: -resource-dir=%S/Inputs/resource_dir \
9+
// RUN: | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
10+
11+
// PRINT-RUNTIME-DIR: lib{{/|\\}}aix{{$}}

clang/test/SemaCXX/builtins.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,21 @@ static void __builtin_cpu_init(); // expected-error {{static declaration of '__b
177177
#endif
178178

179179
#ifdef _MSC_VER
180-
constexpr int x = []{ __noop; return 0; }(); // expected-no-diagnostics
180+
constexpr int x = [] {
181+
__noop;
182+
return 0;
183+
}(); // expected-no-diagnostics
184+
static_assert([] { return __noop; }() == 0);
185+
static_assert([] { return __noop(4); }() == 0);
186+
extern int not_accessed;
187+
void not_called();
188+
static_assert([] { return __noop(not_accessed *= 6); }() == 0);
189+
static_assert([] { return __noop(not_called()); }() == 0);
190+
static_assert([] { return __noop(throw ""); }() == 0);
191+
static_assert([] { return __noop(throw "", throw ""); }() == 0);
192+
static_assert([] {
193+
int a = 5;
194+
__noop(++a);
195+
return a;
196+
}() == 5);
181197
#endif

clang/test/SemaObjC/non-trivial-c-union.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -fobjc-runtime-has-weak -I %S/Inputs -verify %s
2+
// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -fobjc-runtime-has-weak -I %S/Inputs -verify -fexperimental-new-constant-interpreter %s
23

34
#include "non-trivial-c-union.h"
45

clang/test/SemaTemplate/concepts-friends.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,3 +525,26 @@ struct S {
525525
};
526526

527527
}
528+
529+
namespace GH78101 {
530+
531+
template <typename T, int i>
532+
concept True = true;
533+
534+
template <typename T, int I> struct Template {
535+
static constexpr int i = I;
536+
537+
friend constexpr auto operator+(True<i> auto f) { return i; }
538+
};
539+
540+
template <int I> struct Template<float, I> {
541+
static constexpr int i = I;
542+
543+
friend constexpr auto operator+(True<i> auto f) { return i; }
544+
};
545+
546+
Template<void, 4> f{};
547+
548+
static_assert(+Template<float, 5>{} == 5);
549+
550+
} // namespace GH78101

0 commit comments

Comments
 (0)