Issue 151113
Summary [clang] Unnecessary instantiations of `constexpr` functions in `if constexpr (false)`
Labels clang
Assignees
Reporter Eisenwave
    ```cpp
template <int N>
static constexpr void f() {
    static_assert(N == 0);
}

void g() {
    if constexpr (false) {
        f<1>();
    }
}
```
This fails to compile: https://gcc.godbolt.org/z/G87rsPjWo (GCC accepts)

Removing `constexpr` from `f()` makes this compile, but it shouldn't matter either way. `f()` is not odr-used, not constant-evaluated, or otherwise needs to be instantiated.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to