Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for llvm/llvm-project#69717 #774

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,13 @@ class Sema final {
return result;
}

// Saves the current floating-point pragma stack and clear it in this Sema.
class FpPragmaStackSaveRAII {
public:
FpPragmaStackSaveRAII(Sema &S) : S(S), SavedStack(S.FpPragmaStack) {}
FpPragmaStackSaveRAII(Sema &S)
: S(S), SavedStack(std::move(S.FpPragmaStack)) {
S.FpPragmaStack.Stack.clear();
}
~FpPragmaStackSaveRAII() { S.FpPragmaStack = std::move(SavedStack); }

private:
Expand All @@ -722,7 +726,6 @@ class Sema final {

void resetFPOptions(FPOptions FPO) {
CurFPFeatures = FPO;
FpPragmaStack.Stack.clear();
FpPragmaStack.CurrentValue = FPO.getChangesFrom(FPOptions(LangOpts));
}

Expand Down
18 changes: 18 additions & 0 deletions clang/test/Sema/PR69717.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -verify -fsyntax-only %s
// REQUIRES: x86-registered-target
// expected-no-diagnostics

// Testcase for https://github.com/llvm/llvm-project/issues/69717

#pragma float_control(precise, on, push)

template<typename T>
constexpr T multi(T x, T y) {
return x * y;
}

int multi_i(int x, int y) {
return multi<int>(x, y);
}

#pragma float_control(pop)
Loading