Skip to content

Feature: Investigate the MSVC extension __declspec property #23

Open

Description

@YexuanXiao

Currently, this extension is supported by MSVC, Clang, and EDG (Intellisense), but not by GCC. It is necessary to check for any unexpected behavior of this extension on MSVC and Clang. If it is available, consider introducing this feature for C++/WinRT Plus. The option -getter-extension needs to be added and options also need to be added for MSBuild.

This extension will bring a C#-like experience to C++ users and help C# users adapt.

Add option -ms-extension-property. When this option is enabled, the function names of the current runtime class's properties will be changed to _get_Property and _set_Property, and the member declaration __declspec(property(get = _get_Property, put = _set_Property)) T Property; will be added.

Doc: https://learn.microsoft.com/en-us/cpp/cpp/property-cpp?view=msvc-170

Activity

  1. added
    documentation
    enhancement
    help wanted
    feature
    external
    and removed
    enhancement
    on Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationexternalfeaturehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions