Skip to content

_CONTROL_FLOW_GUARD IntelliSense bug #14310

Closed
Closed

Description

@juan-amd

Environment

  • OS and Version: Windows 11
  • VS Code Version: 1.112.0
  • C/C++ Extension Version: 1.31.2

Bug Summary and Steps to Reproduce

Bug Summary:
_CONTROL_FLOW_GUARD defined by MSVC compiler not showing up in C++ IntelliSense properly.

From the official Microsoft documentation:
_CONTROL_FLOW_GUARD defined as 1 when the /guard:cf (Enable Control Flow Guard) compiler option is set. Otherwise, undefined.

Source: https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

Steps to reproduce:

  1. Compile a project with control flow guard enabled
if (MSVC)
    add_compile_options(/guard:cf)
    add_link_options(/GUARD:CF)
endif()
  1. Add C++ code to ensure this is being set properly.
#ifndef _CONTROL_FLOW_GUARD
#error "Control flow guard is not enabled!"
#endif
Image

It's important to note that _MT is another predefined-macro defined by the MSVC compiler. However, that one doesn't have an IntelliSense issue.

Configuration and Logs

Can't supply log. When I ran C/C++ Log Diagnostics proprietary company info was getting logged.

This issue is super easy to reproduce I've seen it on other developers machines for a while now.

Other Extensions

Only the standard C/C++/CMake Microsoft extensions

Additional context

Link to open-source version of project:
https://github.com/GPUOpen-Tools/gpu_performance_api

Permalink to problematic code in question:
https://github.com/GPUOpen-Tools/gpu_performance_api/blob/7976216f2848956030e15143a0057a3fe65600f7/source/gpu_perf_api_counters/gpu_perf_api_counters.cc#L55

Activity

  1. changed the title [-]_CONTROL_FLOW_GUARD[/-] [+]_CONTROL_FLOW_GUARD IntelliSense bug[/+] on Mar 21, 2026
  2. sean-mcmanus commented on Mar 23, 2026

    @sean-mcmanus
    Contributor

    juan-amd Thanks for reporting this. I created another issue to track reviewing the other predefined msvc macros we might not be handling correctly at #14312.

  3. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    and removed
    Visual StudioInherited from Visual Studio
    on Mar 23, 2026
  4. moved this from Pull Request to Done in cpptoolson Mar 23, 2026
  5. locked and limited conversation to collaborators on May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.quick fix

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions