The following code does not compile with clang 5.0.0 (compilation flags are -std=c++14 -Wall -Wextra -Werror -pedantic-errors -O0
):
struct foo
{
};
int main()
{
foo f;
f.~decltype(f)(); // OK
f.template ~decltype(f)(); // OK
int i{};
i.~decltype(i)(); // OK
i.template ~decltype(i)(); // error: expected unqualified-id
}
Is it a way to force the compilation of a pseudo-destructor call with the template
keyword?