Skip to content

Commit 199dc79

Browse files
author
Aidan
committed
revert hack/tests. Next commit will clean up error messages
1 parent 6c48041 commit 199dc79

File tree

8 files changed

+14
-27
lines changed

8 files changed

+14
-27
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4877,8 +4877,7 @@ def note_ovl_candidate_explicit_arg_mismatch_detail : Note<
48774877
"|: expected a type, but got value '%1'"
48784878
"|: expected constant of type %3 but got type %1"
48794879
"|: could not convert '%1' from %2 to %3"
4880-
"| for %ordinal4 template parameter"
4881-
"|: expr is not a valid const expr in the expected context}0">;
4880+
"| for %ordinal4 template parameter}0">;
48824881

48834882
def note_ovl_candidate_unsatisfied_constraints : Note<
48844883
"candidate template ignored: constraints not satisfied%0">;

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16814,17 +16814,8 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
1681416814
(!EvaluateDestruction(Ctx, Base, Result.Val, T, getBeginLoc(), Result,
1681516815
true) ||
1681616816
Result.HasSideEffects)) {
16817-
16818-
// FIXME: err_constexpr_var_requires_const_destruction?
16819-
PartialDiagnostic PD(diag::err_constexpr_var_requires_const_destruction,
16820-
const_cast<ASTContext &>(Ctx).getDiagAllocator());
16821-
std::string ExprStr;
16822-
llvm::raw_string_ostream OS(ExprStr);
16823-
this->printPretty(OS, nullptr, PrintingPolicy(Ctx.getLangOpts()));
16824-
PD << ExprStr;
16825-
SourceLocation Loc = this->getBeginLoc();
16826-
Result.Diag->insert(Result.Diag->begin(), PartialDiagnosticAt(Loc, PD));
16827-
16817+
// FIXME: Prefix a note to indicate that the problem is lack of constant
16818+
// destruction.
1682816819
return false;
1682916820
}
1683016821

clang/lib/Sema/SemaOverload.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11730,15 +11730,15 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
1173011730
if (SecondArg.isNull())
1173111731
return {2, NTTPD->getIndex(), NTTPD->getType()};
1173211732
else {
11733-
// FIXME: this is a hack, we should do this in SemaTempalteDeduction
11734-
// or even ExprConstant. Perhaps an InvalidExplicitArguments error
11735-
// is not what we want
11733+
// FIXME: This is a hack. We should emit a better message
11734+
// for ill-formed const exprs in >=C++20.
1173611735
QualType qt = NTTPD->getType();
11737-
if (qt.getCanonicalType() !=
11738-
SecondArg.getAsType().getCanonicalType()) {
11739-
return {3, NTTPD->getIndex(), NTTPD->getType()};
11736+
if (qt.getCanonicalType() ==
11737+
SecondArg.getAsType().getCanonicalType() &&
11738+
__cplusplus <= 201703) {
11739+
return {4, NTTPD->getIndex(), NTTPD->getType()};
1174011740
} else {
11741-
return {5, NTTPD->getIndex(), NTTPD->getType()};
11741+
return {3, NTTPD->getIndex(), NTTPD->getType()};
1174211742
}
1174311743
}
1174411744
}

clang/lib/Sema/SemaTemplateDeduction.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,9 +3573,6 @@ TemplateDeductionResult Sema::SubstituteExplicitTemplateArguments(
35733573
/*UpdateArgsWithConversions=*/false) ||
35743574
Trap.hasErrorOccurred()) {
35753575

3576-
// FIXME: decide if ill formed const expr or regular
3577-
// InvalidExplicitArguments?
3578-
35793576
unsigned Index = SugaredBuilder.size();
35803577
if (Index >= TemplateParams->size())
35813578
return TemplateDeductionResult::SubstitutionFailure;

clang/test/AST/ByteCode/cxx20.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ namespace FailingDestructor {
751751
}
752752
};
753753
template<D d> // both-note{{template parameter is declared here}}
754-
void f() {} // both-note{{candidate template ignored: invalid explicitly-specified argument: expr is not a valid const expr in the expected context}}
754+
void f() {} // both-note{{andidate template ignored: invalid explicitly-specified argument for 1st template parameter}}
755755

756756
void g() {
757757
f<D{0, false}>(); // both-error {{no matching function}}

clang/test/CXX/drs/cwg3xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ namespace cwg354 { // cwg354: 3.1 c++11
982982
int b1 = both<(int*)0>();
983983
// cxx98-error@-1 {{no matching function for call to 'both'}}
984984
// cxx98-note@#cwg354-both-int-ptr {{template parameter is declared here}}
985-
// cxx98-note@#cwg354-both-int-ptr {{candidate template ignored: invalid explicitly-specified argument: could not convert '(int *)0' from 'int *' to 'int'}}
985+
// cxx98-note@#cwg354-both-int-ptr {{candidate template ignored: invalid explicitly-specified argument for 1st template parameter}}
986986
// cxx98-note@#cwg354-both-int {{template parameter is declared here}}
987987
// cxx98-note@#cwg354-both-int {{candidate template ignored: invalid explicitly-specified argument: could not convert '(int *)0' from 'int *' to 'int'}}
988988

clang/test/CXX/temp/temp.param/p8-cxx20.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace ConstDestruction {
4040
};
4141

4242
template<D d> // expected-note 2{{template parameter is declared here}}
43-
void f() {} // expected-note 2{{candidate template ignored: invalid explicitly-specified argument: expr is not a valid const expr in the expected context}}
43+
void f() {} // expected-note 2{{candidate template ignored: invalid explicitly-specified argument for 1st template parameter}}
4444

4545
void g() {
4646
f<D{0, true}>();

clang/test/SemaCXX/constexpr-function-recovery-crash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ constexpr void test8() {
6060
throw "bad";
6161
}
6262

63-
template<int x> constexpr int f(int y) { //expected-note {{template parameter is declared here}} // expected-note {{candidate template ignored: invalid explicitly-specified argument: expr is not a valid const expr in the expected context}}
63+
template<int x> constexpr int f(int y) { //expected-note {{template parameter is declared here}} // expected-note {{candidate template ignored: invalid explicitly-specified argument for 1st template parameter}}
6464
return x * y;
6565
}
6666
constexpr int test9(int x) {

0 commit comments

Comments
 (0)