public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98768] New: Improve diagnostics for incorrect result type checking "-> Type" in concepts
@ 2021-01-20 13:50 antoshkka at gmail dot com
2021-01-20 14:36 ` [Bug c++/98768] " redi at gcc dot gnu.org
2021-01-20 14:36 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: antoshkka at gmail dot com @ 2021-01-20 13:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98768
Bug ID: 98768
Summary: Improve diagnostics for incorrect result type checking
"-> Type" in concepts
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 Callable0Arg = requires(Function func) {
func() -> T;
};
The expression "-> T" is valid only if the "func()" returns pointer to a type
that has member "T". At the same time there is an unused "typename T" in the
concept definition.
For such cases a warning like "Unused `T` in concept definition. Did you mean
`-> std::same_as<T>`" would be really helpful.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/98768] Improve diagnostics for incorrect result type checking "-> Type" in concepts
2021-01-20 13:50 [Bug c++/98768] New: Improve diagnostics for incorrect result type checking "-> Type" in concepts antoshkka at gmail dot com
@ 2021-01-20 14:36 ` redi at gcc dot gnu.org
2021-01-20 14:36 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-20 14:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98768
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Antony Polukhin from comment #0)
> For such cases a warning like "Unused `T` in concept definition. Did you
> mean `-> std::same_as<T>`" would be really helpful.
That wouldn't fix it though, the correct form would be:
{ func() } -> T;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/98768] Improve diagnostics for incorrect result type checking "-> Type" in concepts
2021-01-20 13:50 [Bug c++/98768] New: Improve diagnostics for incorrect result type checking "-> Type" in concepts antoshkka at gmail dot com
2021-01-20 14:36 ` [Bug c++/98768] " redi at gcc dot gnu.org
@ 2021-01-20 14:36 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-20 14:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98768
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oops! I meant:
{ func() } -> std::same_as<T>;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-20 14:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 13:50 [Bug c++/98768] New: Improve diagnostics for incorrect result type checking "-> Type" in concepts antoshkka at gmail dot com
2021-01-20 14:36 ` [Bug c++/98768] " redi at gcc dot gnu.org
2021-01-20 14:36 ` redi 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).