File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -687,26 +687,29 @@ bool ByteCodeStmtGen<Emitter>::visitDefaultStmt(const DefaultStmt *S) {
687687template <class Emitter >
688688bool ByteCodeStmtGen<Emitter>::visitAttributedStmt(const AttributedStmt *S) {
689689
690- for (const Attr *A : S->getAttrs ()) {
691- auto *AA = dyn_cast<CXXAssumeAttr>(A);
692- if (!AA)
693- continue ;
690+ if (this ->Ctx .getLangOpts ().CXXAssumptions &&
691+ !this ->Ctx .getLangOpts ().MSVCCompat ) {
692+ for (const Attr *A : S->getAttrs ()) {
693+ auto *AA = dyn_cast<CXXAssumeAttr>(A);
694+ if (!AA)
695+ continue ;
694696
695- assert (isa<NullStmt>(S->getSubStmt ()));
697+ assert (isa<NullStmt>(S->getSubStmt ()));
696698
697- const Expr *Assumption = AA->getAssumption ();
698- if (Assumption->isValueDependent ())
699- return false ;
699+ const Expr *Assumption = AA->getAssumption ();
700+ if (Assumption->isValueDependent ())
701+ return false ;
700702
701- if (Assumption->HasSideEffects (this ->Ctx .getASTContext ()))
702- continue ;
703+ if (Assumption->HasSideEffects (this ->Ctx .getASTContext ()))
704+ continue ;
703705
704- // Evaluate assumption.
705- if (!this ->visitBool (Assumption))
706- return false ;
706+ // Evaluate assumption.
707+ if (!this ->visitBool (Assumption))
708+ return false ;
707709
708- if (!this ->emitAssume (Assumption))
709- return false ;
710+ if (!this ->emitAssume (Assumption))
711+ return false ;
712+ }
710713 }
711714
712715 // Ignore other attributes.
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -std=c++23 -x c++ %s -fno-assumptions -verify
22// RUN: %clang_cc1 -std=c++23 -x c++ %s -fms-compatibility -verify
3+ // RUN: %clang_cc1 -std=c++23 -x c++ %s -fno-assumptions -fexperimental-new-constant-interpreter -verify
4+ // RUN: %clang_cc1 -std=c++23 -x c++ %s -fms-compatibility -fexperimental-new-constant-interpreter -verify
5+
36// expected-no-diagnostics
47
58// We don't check assumptions at compile time if '-fno-assumptions' is passed,
You can’t perform that action at this time.
0 commit comments