As far as I'm aware, the following code:
template<typename T>
struct S {
S<T>();
};
is well-formed, even though the <T>
in the declaration of the constructor is redundant.
However, on gcc trunk (but not on gcc10.2), with -std=c++20
this gives an error:
error: expected unqualified-id before ')' token
3 | S<T>();
^
The code compiles on clang trunk with -std=c++20
. Is this a bug, or is this a breaking change in c++20 that is yet to be implemented in all compilers?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…