On 2/18/19 5:31 AM, Paolo Carlini wrote:
Hi Jason,
On 18/02/19 10:20, Jason Merrill wrote:
On 2/17/19 6:58 AM, Paolo Carlini wrote:
Hi,
here, when we don't see an initializer we believe we are surely
dealing with a case of C++17 template argument deduction for class
templates, but, in fact, it's just an ill-formed C++14 template
variable specialization. Conveniently, we can use here too the
predicate variable_template_specialization_p. Not 100% sure about the
exact wording of the error message, I added '#' to %qD to explicitly
print the auto-using type too.
I guess we should change the assert to a test, so that we give the
error if we aren't dealing with a class template placeholder. Variable
templates don't seem to be important to test for.
Thanks, simpler patch.
This error is also pretty poor for this testcase, where there is an
initializer.
Well, implementation-wise, certainly init == NULL_TREE and only when we
have an empty pack this specific issue occurs.
In practice, clang simply talks about an empty initializer (during
instantiation, etc, like we do), whereas EDG explicitly says that pack
expansion produces an empty list of expressions. I don't think that in
cp_finish_decl it would be easy for us to do exactly the same, we simply
see a NULL_TREE as second argument. Or we could just *assume* that we
are dealing with the outcome of a pack expansion, say something like EDG
even if we don't have details beyond the fact that init == NULL_TREE. I
believe that without a variadic template the problem cannot occur,
because we catch the empty initializer much earlier, in grokdeclarator -
indeed using a !CLASS_PLACEHOLDER_TEMPLATE (auto_node) check. What do
you think? Again "instantiated for an empty pack" or something similar?
Perhaps we could complain in the code for empty pack expansion handling
in tsubst_init?
Jason