[Bug c++/89442] [concepts] missing "wrong number of template arguments" error in requires-clause

2023-06-28 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89442

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
   Target Milestone|--- |14.0
 CC||ppalka at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #3 from Patrick Palka  ---
Fixed for GCC 14

[Bug c++/89442] [concepts] missing "wrong number of template arguments" error in requires-clause

2023-06-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89442

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:4cf64d9cc2faf4001f037a50a350abd0f95f3e29

commit r14-2170-g4cf64d9cc2faf4001f037a50a350abd0f95f3e29
Author: Patrick Palka 
Date:   Wed Jun 28 15:43:33 2023 -0400

c++: ahead of time variable template-id coercion [PR89442]

This patch makes us coerce the arguments of a variable template-id ahead
of time, as we do for class template-ids, which causes us to immediately
diagnose template parm/arg kind mismatches and arity mismatches.

Unfortunately this causes a regression in cpp1z/constexpr-if20.C: coercing
the variable template-id m ahead of time means we strip it of
typedefs, yielding m::q, typename C::q>, but in this
stripped form we're directly using 'i' and so we expect to have captured
it.  This is a variable template version of PR107437.

PR c++/89442
PR c++/107437

gcc/cp/ChangeLog:

* cp-tree.h (lookup_template_variable): Add complain parameter.
* parser.cc (cp_parser_template_id): Pass tf_warning_or_error
to lookup_template_variable.
* pt.cc (lookup_template_variable): Add complain parameter.
Coerce template arguments here ...
(finish_template_variable): ... instead of here.
(lookup_and_finish_template_variable): Check for error_mark_node
result from lookup_template_variable.
(tsubst_copy) : Pass complain to
lookup_template_variable.
(instantiate_template): Use build2 instead of
lookup_template_variable to build a TEMPLATE_ID_EXPR
for most_specialized_partial_spec.

gcc/testsuite/ChangeLog:

* g++.dg/cpp/pr64127.C: Expect "expected unqualified-id at end
of input" error.
* g++.dg/cpp0x/alias-decl-ttp1.C: Fix template parameter/argument
kind mismatch for variable template has_P_match_V.
* g++.dg/cpp1y/pr72759.C: Expect "template argument 1 is invalid"
error.
* g++.dg/cpp1z/constexpr-if20.C: XFAIL test due to bogus "'i' is
not captured" error.
* g++.dg/cpp1z/noexcept-type21.C: Fix arity of variable template d.
* g++.dg/diagnostic/not-a-function-template-1.C: Add default
template argument to variable template A so that A<> is valid.
* g++.dg/parse/error56.C: Don't expect "ISO C++ forbids
declaration with no type" error.
* g++.dg/parse/template30.C: Don't expect "parse error in
template argument list" error.
* g++.dg/cpp1y/var-templ82.C: New test.

[Bug c++/89442] [concepts] missing "wrong number of template arguments" error in requires-clause

2019-11-15 Thread andrew.n.sutton at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89442

Andrew Sutton  changed:

   What|Removed |Added

 CC||andrew.n.sutton at gmail dot 
com

--- Comment #1 from Andrew Sutton  ---
The error is a little better in trunk, but I think this should be caught when
it's parsed: you can't ever use foo with one argument.

Looking into this, we aren't converting template arguments for dependent
variable templates in finish_id_expr, but we probably should.

I don't think this is strictly concepts-related.

[Bug c++/89442] [concepts] missing "wrong number of template arguments" error in requires-clause

2019-02-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89442

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-02-21
 Blocks||67491
 Ever confirmed|0   |1


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues