public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98767] New: Function signature lost in concept diagnostic message
@ 2021-01-20 13:31 antoshkka at gmail dot com
2021-01-20 14:37 ` [Bug c++/98767] " redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: antoshkka at gmail dot com @ 2021-01-20 13:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98767
Bug ID: 98767
Summary: Function signature lost in concept diagnostic message
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
Consider the example:
template <typename Function, typename T>
concept Callable1Arg = requires(Function func, T value) {
func(value);
};
// Should fail and fails:
static_assert(Callable1Arg<int(*)(int*), bool>);
The diagnotics has the following line:
"in requirements with 'Function func', 'T value' [with T = bool; Function = int
(*)()]"
However the type of the Function is "int (*)(int*)" not "int (*)()"
Godbolt playground: https://godbolt.org/z/afKqq5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98767] Function signature lost in concept diagnostic message
2021-01-20 13:31 [Bug c++/98767] New: Function signature lost in concept diagnostic message antoshkka at gmail dot com
@ 2021-01-20 14:37 ` redi at gcc dot gnu.org
2021-01-25 13:30 ` ensadc at mailnesia dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-20 14:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98767
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-01-20
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98767] Function signature lost in concept diagnostic message
2021-01-20 13:31 [Bug c++/98767] New: Function signature lost in concept diagnostic message antoshkka at gmail dot com
2021-01-20 14:37 ` [Bug c++/98767] " redi at gcc dot gnu.org
@ 2021-01-25 13:30 ` ensadc at mailnesia dot com
2021-04-16 22:58 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ensadc at mailnesia dot com @ 2021-01-25 13:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98767
ensadc at mailnesia dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ensadc at mailnesia dot com
--- Comment #1 from ensadc at mailnesia dot com ---
The parameter list is printed by `pp_cxx_parameter_declaration_clause` defined
in gcc/cp/cxx-pretty-print.c
(https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/cp/cxx-pretty-print.c;h=a22eea5239c33ed946abe46539e588b04e7beca7;hb=HEAD#l1538
), where the parameter types are printed in a loop that starts with:
> for (; args; args = TREE_CHAIN (args), types = TREE_CHAIN (types))
Here `args` was initialized with:
> args = type_p ? NULL : FUNCTION_FIRST_USER_PARM (t);
It seems that when a type is passed to `pp_cxx_parameter_declaration_clause`,
`args` is always set to NULL, and the loop is never entered.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98767] Function signature lost in concept diagnostic message
2021-01-20 13:31 [Bug c++/98767] New: Function signature lost in concept diagnostic message antoshkka at gmail dot com
2021-01-20 14:37 ` [Bug c++/98767] " redi at gcc dot gnu.org
2021-01-25 13:30 ` ensadc at mailnesia dot com
@ 2021-04-16 22:58 ` ppalka at gcc dot gnu.org
2021-04-23 12:47 ` cvs-commit at gcc dot gnu.org
2022-03-13 0:52 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-16 22:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98767
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |ppalka at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98767] Function signature lost in concept diagnostic message
2021-01-20 13:31 [Bug c++/98767] New: Function signature lost in concept diagnostic message antoshkka at gmail dot com
` (2 preceding siblings ...)
2021-04-16 22:58 ` ppalka at gcc dot gnu.org
@ 2021-04-23 12:47 ` cvs-commit at gcc dot gnu.org
2022-03-13 0:52 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-23 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98767
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:87fc34a461cf362947a430d8a241f653fd83bc7b
commit r12-86-g87fc34a461cf362947a430d8a241f653fd83bc7b
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Apr 23 08:47:02 2021 -0400
c++: Fix pretty printing pointer to function type [PR98767]
When pretty printing a pointer to function type,
pp_cxx_parameter_declaration_clause ends up always outputting an empty
function parameter list because the loop that outputs the list iterates
over 'args' instead of 'types', and 'args' is empty when a FUNCTION_TYPE
is passed to this routine (as opposed to a FUNCTION_DECL).
This patch fixes this by making the loop iterate over 'types' instead.
This patch also moves the retrofitted chain-of-PARM_DECLs printing from
here to pp_cxx_requires_expr, the only caller that uses it. Doing so
lets us easily output the trailing '...' in the parameter list of a
variadic function, which this patch also implements.
gcc/cp/ChangeLog:
PR c++/98767
* cxx-pretty-print.c (pp_cxx_parameter_declaration_clause):
Adjust parameter list loop to iterate over 'types' instead of
'args'. Output the trailing '...' for a variadic function.
Remove PARM_DECL support.
(pp_cxx_requires_expr): Pretty print the parameter list directly
instead of going through pp_cxx_parameter_declaration_clause.
gcc/testsuite/ChangeLog:
PR c++/98767
* g++.dg/concepts/diagnostic17.C: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98767] Function signature lost in concept diagnostic message
2021-01-20 13:31 [Bug c++/98767] New: Function signature lost in concept diagnostic message antoshkka at gmail dot com
` (3 preceding siblings ...)
2021-04-23 12:47 ` cvs-commit at gcc dot gnu.org
@ 2022-03-13 0:52 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-13 0:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98767
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Closing as fixed for GCC 12
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-13 0:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 13:31 [Bug c++/98767] New: Function signature lost in concept diagnostic message antoshkka at gmail dot com
2021-01-20 14:37 ` [Bug c++/98767] " redi at gcc dot gnu.org
2021-01-25 13:30 ` ensadc at mailnesia dot com
2021-04-16 22:58 ` ppalka at gcc dot gnu.org
2021-04-23 12:47 ` cvs-commit at gcc dot gnu.org
2022-03-13 0:52 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).