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

Clang doesn't generate a function when using __array_rank #57133

Open
philnik777 opened this issue Aug 13, 2022 · 3 comments
Open

Clang doesn't generate a function when using __array_rank #57133

philnik777 opened this issue Aug 13, 2022 · 3 comments
Labels
clang:codegen clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@philnik777
Copy link
Contributor

The code (Godbolt)

#include <__type_traits/integral_constant.h>

template <class T>
struct rank : std::integral_constant<int, __array_rank(T)> {};

template <class T>
void test_rank() {
  static_assert(rank<T>::value == 0);
}

void func() {
  test_rank<void>();
}

generates func(), but doesn't generate test_rank<void>().

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 13, 2022

@llvm/issue-subscribers-clang-codegen

@cjdb
Copy link
Contributor

cjdb commented Sep 25, 2022

Potentially related: return statement in f is ignored.

template<auto v>
struct integral_constant {
    static inline constexpr auto value = v;
};

template<class T>
struct rank : integral_constant<__array_rank(T)> {};

__SIZE_TYPE__ f()
{
  return rank<int[1]>::value;
}

@cjdb cjdb added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Sep 25, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 25, 2022

@llvm/issue-subscribers-clang-frontend

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

No branches or pull requests

3 participants