[Bug c++/66427] New: The compiler rejects too complex variable templates
morwenn29 at hotmail dot fr
gcc-bugzilla@gcc.gnu.org
Fri Jun 5 08:18:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66427
Bug ID: 66427
Summary: The compiler rejects too complex variable templates
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: morwenn29 at hotmail dot fr
Target Milestone: ---
I was trying to replace structures with a single value member by variable
templates but it seems that their support still isn't complete enough to
support my use case. I couldn't find a reasonable "minimal" example, so here is
the code that triggered the error:
#include <complex>
struct plus {};
struct multiplies {};
// ...
template<typename T, typename Op>
constexpr T identity_element;
template<>
constexpr int identity_element<int, plus> = 0;
template<typename T>
constexpr std::complex<T> identity_element<std::complex<T>, plus> = {
identity_element<T, plus>,
identity_element<T, plus>
};
And here are the generated error messages:
main.cpp:15:23: error: expected primary-expression before ',' token
identity_element<T, plus>,
^
main.cpp:15:29: error: expected primary-expression before '>' token
identity_element<T, plus>,
^
main.cpp:15:30: error: expected primary-expression before ',' token
identity_element<T, plus>,
^
main.cpp:16:23: error: expected primary-expression before ',' token
identity_element<T, plus>
^
main.cpp:16:29: error: expected primary-expression before '>' token
identity_element<T, plus>
^
main.cpp:17:1: error: expected primary-expression before '}' token
};
^
More information about the Gcc-bugs
mailing list