microsoft / microsoft/STL

`<numeric>`: error C3198: invalid use of floating-point pragmas: fenv_access pragma operates only in precise mode

Open
#2,613 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Describe the bug
Enabling fenv_access prior to including <numeric> triggers error C3198.

Command-line test case

// float_control.cpp
#pragma fenv_access(on)
#include <numeric>

int main() {}
D:\>cl /std:c++17 float_control.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.31.31104 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

float_control.cpp
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\numeric(52): error C3198: invalid use of floating-point pragmas: fenv_access pragma operates only in precise mode
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\numeric(158): error C3198: invalid use of floating-point pragmas: fenv_access pragma operates only in precise mode

Expected behavior
No error.

STL version

Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.1.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided float_control.cpp reproduction and inspect the header locations reported at lines 52 and 158. Run the MSVC command shown with /std:c++17, then trace the floating-point pragma handling in those header sections. Done means enabling fenv_access before including no longer produces C3198.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.