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

Add C++23 to CppStdRevision enum #21043

Merged
merged 1 commit into from
Mar 21, 2025
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
4 changes: 4 additions & 0 deletions changelog/dmd.extern-std-cpp23.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The compiler now accepts `-extern-std=c++23`

The compiler now accepts c++23 as a supported standard for `-extern-std=`.
Currently this only changes the value of `__traits(getTargetInfo, "cppStd")`.
3 changes: 3 additions & 0 deletions compiler/src/dmd/cli.d
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ dmd -cov -unittest myprog.d
Sets `__traits(getTargetInfo, \"cppStd\")` to `201703`)
$(LI $(I c++20): Use C++20 name mangling,
Sets `__traits(getTargetInfo, \"cppStd\")` to `202002`)
$(LI $(I c++23): Use C++23 name mangling,
Sets `__traits(getTargetInfo, \"cppStd\")` to `202302`)
)",
),
Option("extern-std=[h|help|?]",
Expand Down Expand Up @@ -1122,6 +1124,7 @@ struct CLIUsage
=c++14 Sets `__traits(getTargetInfo, \"cppStd\")` to `201402`
=c++17 Sets `__traits(getTargetInfo, \"cppStd\")` to `201703`
=c++20 Sets `__traits(getTargetInfo, \"cppStd\")` to `202002`
=c++23 Sets `__traits(getTargetInfo, \"cppStd\")` to `202302`
";

/// Options supported by -HC
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dmd/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -6234,6 +6234,7 @@ enum class CppStdRevision : uint32_t
cpp14 = 201402u,
cpp17 = 201703u,
cpp20 = 202002u,
cpp23 = 202302u,
};

enum class CHECKENABLE : uint8_t
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dmd/globals.d
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum CppStdRevision : uint
cpp14 = 2014_02,
cpp17 = 2017_03,
cpp20 = 2020_02,
cpp23 = 2023_02,
}

/// Trivalent boolean to represent the state of a `revert`able change
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dmd/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ enum CppStdRevision
CppStdRevisionCpp11 = 201103,
CppStdRevisionCpp14 = 201402,
CppStdRevisionCpp17 = 201703,
CppStdRevisionCpp20 = 202002
CppStdRevisionCpp20 = 202002,
CppStdRevisionCpp23 = 202302,
};

/// Trivalent boolean to represent the state of a `revert`able change
Expand Down
3 changes: 3 additions & 0 deletions compiler/src/dmd/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,9 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, ref Param
case "c++20":
params.cplusplus = CppStdRevision.cpp20;
break;
case "c++23":
params.cplusplus = CppStdRevision.cpp23;
break;
default:
error("switch `%s` is invalid", p);
params.help.externStd = true;
Expand Down
1 change: 1 addition & 0 deletions druntime/src/core/stdcpp/xutility.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ enum CppStdRevision : uint
cpp14 = 201402,
cpp17 = 201703,
cpp20 = 202002,
cpp23 = 202302,
}

/**
Expand Down
Loading