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

__is_pointer used both as a trait and an identifier seems inconsistent #95598

Closed
pinskia opened this issue Jun 14, 2024 · 2 comments · Fixed by #95969
Closed

__is_pointer used both as a trait and an identifier seems inconsistent #95598

pinskia opened this issue Jun 14, 2024 · 2 comments · Fixed by #95969
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@pinskia
Copy link

pinskia commented Jun 14, 2024

Take:


template<typename _Tp, bool _IsPtr = __is_pointer(_Tp)>
  struct __is_pointer {};

template<typename _Tp>
inline bool t = __is_pointer(_Tp); // is accepted

template<bool>
struct ts{};

template<typename _Tp>
  struct is_pointer : ts<__is_pointer(_Tp)> {}; // is rejected

int tt = t<int>;

I would have expected the variable template t would have been rejected the same way as the template argument for the base class is_pointer being rejected but it is inconsistent here.

This shows up now in libstdc++'s headers (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115497).

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Jun 14, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 14, 2024

@llvm/issue-subscribers-clang-frontend

Author: Andrew Pinski (pinskia)

Take: ```

template<typename _Tp, bool _IsPtr = __is_pointer(_Tp)>
struct __is_pointer {};

template<typename _Tp>
inline bool t = __is_pointer(_Tp); // is accepted

template<bool>
struct ts{};

template<typename _Tp>
struct is_pointer : ts<__is_pointer(_Tp)> {}; // is rejected

int tt = t<int>;


I would have expected the variable template t would have been rejected the same way as the template argument for the base class is_pointer being rejected but it is inconsistent here.

This shows up now in libstdc++'s headers (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115497).
</details>

cor3ntin added a commit to cor3ntin/llvm-project that referenced this issue Jun 18, 2024
Constructs like `__is_pointer(Foo)` are never considered to be
functions declarations.

This matches usages in libstdc++, and we can hope
no one else redefine these reserved identifiers.

Fixes llvm#95598
@mrdaybird
Copy link
Contributor

std::replace_if fails to compile because of this(#96278) Maybe check if it works before closing this issue.

cor3ntin added a commit to cor3ntin/llvm-project that referenced this issue Jul 12, 2024
Constructs like `__is_pointer(Foo)` are never considered to be
functions declarations.

This matches usages in libstdc++, and we can hope
no one else redefine these reserved identifiers.

Fixes llvm#95598
cor3ntin added a commit that referenced this issue Jul 13, 2024
…95969)

Constructs like `__is_pointer(Foo)` are never considered to be functions
declarations.

This matches usages in libstdc++, and we can hope
no one else redefine these reserved identifiers.

Fixes #95598
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this issue Jul 14, 2024
…lvm#95969)

Constructs like `__is_pointer(Foo)` are never considered to be functions
declarations.

This matches usages in libstdc++, and we can hope
no one else redefine these reserved identifiers.

Fixes llvm#95598
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this issue Jul 16, 2024
…lvm#95969)

Constructs like `__is_pointer(Foo)` are never considered to be functions
declarations.

This matches usages in libstdc++, and we can hope
no one else redefine these reserved identifiers.

Fixes llvm#95598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants