25
25
#include " InterpStack.h"
26
26
#include " InterpState.h"
27
27
#include " MemberPointer.h"
28
- #include " Opcode.h"
29
28
#include " PrimType.h"
30
29
#include " Program.h"
31
30
#include " State.h"
@@ -1131,8 +1130,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
1131
1130
S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_past_end)
1132
1131
<< LHS.toDiagnosticString (S.getASTContext ());
1133
1132
return false ;
1134
- } else if (RHS.isOnePastEnd () && !LHS.isOnePastEnd () && !LHS.isZero () &&
1135
- LHS.getOffset () == 0 ) {
1133
+ }
1134
+ if (RHS.isOnePastEnd () && !LHS.isOnePastEnd () && !LHS.isZero () &&
1135
+ LHS.getOffset () == 0 ) {
1136
1136
const SourceInfo &Loc = S.Current ->getSource (OpPC);
1137
1137
S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_past_end)
1138
1138
<< RHS.toDiagnosticString (S.getASTContext ());
@@ -1150,8 +1150,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
1150
1150
const SourceInfo &Loc = S.Current ->getSource (OpPC);
1151
1151
S.FFDiag (Loc, diag::note_constexpr_literal_comparison);
1152
1152
return false ;
1153
- } else if (const auto *CE = dyn_cast<CallExpr>(E);
1154
- CE && IsOpaqueConstantCall (CE)) {
1153
+ }
1154
+ if (const auto *CE = dyn_cast<CallExpr>(E);
1155
+ CE && IsOpaqueConstantCall (CE)) {
1155
1156
const SourceInfo &Loc = S.Current ->getSource (OpPC);
1156
1157
S.FFDiag (Loc, diag::note_constexpr_opaque_call_comparison)
1157
1158
<< P.toDiagnosticString (S.getASTContext ());
@@ -3266,7 +3267,8 @@ inline bool InvalidCast(InterpState &S, CodePtr OpPC, CastKind Kind,
3266
3267
S.CCEDiag (Loc, diag::note_constexpr_invalid_cast)
3267
3268
<< static_cast <unsigned >(Kind) << S.Current ->getRange (OpPC);
3268
3269
return !Fatal;
3269
- } else if (Kind == CastKind::Volatile) {
3270
+ }
3271
+ if (Kind == CastKind::Volatile) {
3270
3272
if (!S.checkingPotentialConstantExpression ()) {
3271
3273
const auto *E = cast<CastExpr>(S.Current ->getExpr (OpPC));
3272
3274
if (S.getLangOpts ().CPlusPlus )
@@ -3277,7 +3279,8 @@ inline bool InvalidCast(InterpState &S, CodePtr OpPC, CastKind Kind,
3277
3279
}
3278
3280
3279
3281
return false ;
3280
- } else if (Kind == CastKind::Dynamic) {
3282
+ }
3283
+ if (Kind == CastKind::Dynamic) {
3281
3284
assert (!S.getLangOpts ().CPlusPlus20 );
3282
3285
S.CCEDiag (S.Current ->getSource (OpPC), diag::note_constexpr_invalid_cast)
3283
3286
<< diag::ConstexprInvalidCastKind::Dynamic;
0 commit comments