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] conversion operator to builtin _Complex not constexpr #108750

Open
willwray opened this issue Sep 15, 2024 · 1 comment · May be fixed by #108758
Open

[clang] conversion operator to builtin _Complex not constexpr #108750

willwray opened this issue Sep 15, 2024 · 1 comment · May be fixed by #108758
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" constexpr Anything related to constant evaluation

Comments

@willwray
Copy link

This arose in a generic context:

struct zero
{
  template <typename T>
  constexpr operator T() const {return {};}
};

constexpr _Complex float z0{zero{}};

error: constexpr variable 'z0' must be initialized by a constant expression

This compiler explorer snippet reduces it to a non-template example
https://godbolt.org/z/YPe63E4Gf

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Sep 15, 2024
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" constexpr Anything related to constant evaluation and removed clang Clang issues not falling into any other category labels Sep 15, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 15, 2024

@llvm/issue-subscribers-clang-frontend

Author: Will Wray (willwray)

This arose in a generic context:
struct zero
{
  template &lt;typename T&gt;
  constexpr operator T() const {return {};}
};

constexpr _Complex float z0{zero{}};

error: constexpr variable 'z0' must be initialized by a constant expression

This compiler explorer snippet reduces it to a non-template example
https://godbolt.org/z/YPe63E4Gf

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" constexpr Anything related to constant evaluation
Projects
None yet
3 participants