On 5/10/19 7:10 PM, Marek Polacek wrote:
When we have
template<auto>
struct S { };
then in
S<int()> s;
"int()" is resolved to a type-id, as per [temp.arg]/2, causing this program to
fail to compile. This can be rather confusing so I think we want to improve the
diagnostic a bit.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2019-05-10 Marek Polacek <pola...@redhat.com>
* pt.c (convert_template_argument): Add a diagnostic for the
[temp.arg]/2 ambiguity case.
* g++.dg/cpp2a/nontype-class17.C: New test.
diff --git gcc/cp/pt.c gcc/cp/pt.c
index 08da94ae0c9..b38e65d7f7e 100644
--- gcc/cp/pt.c
+++ gcc/cp/pt.c
@@ -7961,10 +7961,22 @@ convert_template_argument (tree parm,
+ if (TREE_CODE (arg) == FUNCTION_TYPE)
+ inform (input_location, " template argument for "
+ "non-type template parameter is treated as "
+ "function type");
Maybe add "ambiguous" to the beginning? OK either way.
Jason