This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add `__has_extension ()` for C++11 features
ClosedPublic

Authored by Fznamznon on Jul 3 2023, 4:00 AM.

Details

Summary

Add __has_extension (cxx_defaulted_functions) and
__has_extension (cxx_default_function_template_args) since they are
accepted in C++98 mode as extensions.

Fixes https://github.com/llvm/llvm-project/issues/61758

Diff Detail

Event Timeline

Fznamznon created this revision.Jul 3 2023, 4:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 4:00 AM
Fznamznon requested review of this revision.Jul 3 2023, 4:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 4:00 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Jul 3 2023, 5:26 AM

Thank you for this! LGTM. but can you also be sure to update this table: https://github.com/llvm/llvm-project/blob/main/clang/docs/LanguageExtensions.rst?plain=1#L1429

This revision is now accepted and ready to land.Jul 3 2023, 5:26 AM
Fznamznon edited the summary of this revision. (Show Details)Jul 3 2023, 6:51 AM

Thank you for this! LGTM. but can you also be sure to update this table: https://github.com/llvm/llvm-project/blob/main/clang/docs/LanguageExtensions.rst?plain=1#L1429

Hmm, I have a feeling that the table is for features that have __cpp_* macros defined for them. The features I intended to fix are described by the same doc here - https://github.com/llvm/llvm-project/blob/29f4c398717184a019791ed52d1d0d69ed5dabb6/clang/docs/LanguageExtensions.rst?plain=1#L1071 .

Thank you for this! LGTM. but can you also be sure to update this table: https://github.com/llvm/llvm-project/blob/main/clang/docs/LanguageExtensions.rst?plain=1#L1429

Hmm, I have a feeling that the table is for features that have __cpp_* macros defined for them. The features I intended to fix are described by the same doc here - https://github.com/llvm/llvm-project/blob/29f4c398717184a019791ed52d1d0d69ed5dabb6/clang/docs/LanguageExtensions.rst?plain=1#L1071 .

Oh shoot, you're right, these don't have the typical feature testing macros from http://eel.is/c++draft/tab:cpp.predefined.ft ! Sorry for the noise, this is fine as-is.

This revision was landed with ongoing or failed builds.Jul 3 2023, 7:16 AM
This revision was automatically updated to reflect the committed changes.

Thank you or the quick fix!