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

[libc++] Fix failure with GCC 15 (#117319) #117322

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

killcerr
Copy link

@killcerr killcerr commented Nov 22, 2024

Fixes #117319

@killcerr killcerr requested a review from a team as a code owner November 22, 2024 12:17
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2024

@llvm/pr-subscribers-libcxx

Author: None (killcerr)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/117322.diff

1 Files Affected:

  • (modified) libcxx/include/__type_traits/decay.h (+1-1)
diff --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h
index 7412044f931796..861dc2eb10d061 100644
--- a/libcxx/include/__type_traits/decay.h
+++ b/libcxx/include/__type_traits/decay.h
@@ -25,7 +25,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if __has_builtin(__decay)
+#if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC)
 template <class _Tp>
 using __decay_t _LIBCPP_NODEBUG = __decay(_Tp);
 

@frederick-vs-ja

This comment was marked as resolved.

@killcerr killcerr changed the title [libc++] Fix failure with GCC 15 (#117319) [libc++] Fix failure with GCC 15 (fix #117319) Nov 22, 2024
@killcerr killcerr changed the title [libc++] Fix failure with GCC 15 (fix #117319) [libc++] Fix failure with GCC 15 (Fix #117319) Nov 22, 2024
@killcerr killcerr changed the title [libc++] Fix failure with GCC 15 (Fix #117319) [libc++] Fix failure with GCC 15 (#117319) Nov 22, 2024
@killcerr
Copy link
Author

Hi! I think it would be better to associate this PR withe the issue to be fixed using GitHub's close/fix/resolve syntax.

I already change it.Thanks your comment.

Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support trunk GCC and this is definitely not the only problem. I don't think it makes sense to add an opt-out in a single place when we know that things are still broken.

@killcerr
Copy link
Author

We don't support trunk GCC and this is definitely not the only problem. I don't think it makes sense to add an opt-out in a single place when we know that things are still broken.

Thanks, should i close this pull request?

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@killcerr Is that the only issue you encountered?

@@ -25,7 +25,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__decay)
#if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the GCC-provided builtin incompatible with Clang's?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCC doesn't mangle the builtin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so do we need to do something like

template <class _Tp>
struct __decay_impl {
  using type = __builtin_decay_t(_Tp);
};

template <class _Tp>
using __decay_t = typename __decay_impl<_Tp>::type;

?

Copy link
Author

@killcerr killcerr Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the same way in similar issue
to fix this issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, something like that. I'd probably just use decay as the base (i.e. using __decay_t = decay<T>::type) for GCC.

@killcerr
Copy link
Author

@killcerr Is that the only issue you encountered?

Yes, I met it when I complie GCC 15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc++] libc++ doesn't compile with gcc 15
5 participants