diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 8188d6f7f5c24..3e2c6be602903 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -374,7 +374,7 @@ bool ByteCodeExprGen::VisitBinaryOperator(const BinaryOperator *BO) { // Special case for C++'s three-way/spaceship operator <=>, which // returns a std::{strong,weak,partial}_ordering (which is a class, so doesn't // have a PrimType). - if (!T) { + if (!T && Ctx.getLangOpts().CPlusPlus) { if (DiscardResult) return true; const ComparisonCategoryInfo *CmpInfo = diff --git a/clang/test/Sema/struct-cast.c b/clang/test/Sema/struct-cast.c index 74d00c42c295e..05e5fa4f92ca7 100644 --- a/clang/test/Sema/struct-cast.c +++ b/clang/test/Sema/struct-cast.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only %s -verify +// RUN: %clang_cc1 -fsyntax-only %s -fexperimental-new-constant-interpreter -verify // expected-no-diagnostics struct S {