[Bug c++/102194] New: Incorrect explicit instantiation of constexpr variable accepted
fchelnokov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 3 17:43:16 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102194
Bug ID: 102194
Summary: Incorrect explicit instantiation of constexpr variable
accepted
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
This incorrect instantiation is accepted by GCC
```
template<int N> constexpr long long fib = fib<N-1> + fib<N-2>;
template<> constexpr long long fib<1> = 1;
template<> constexpr long long fib<2> = 1;
template long long fib<70>; // error here, `const` is missing
```
The correct last line must be:
```
template const long long fib<70>;
```
More information about the Gcc-bugs
mailing list