public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104094] New: Alias template shown in diagnostic with wrong template parameter name
@ 2022-01-18 13:22 redi at gcc dot gnu.org
2022-01-19 0:50 ` [Bug c++/104094] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-18 13:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104094
Bug ID: 104094
Summary: Alias template shown in diagnostic with wrong template
parameter name
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
template<typename> struct trait;
template<typename A> struct trait { using type = A; };
template<typename B> struct cond { static constexpr bool value = true; };
template<bool> struct enable_if { using type = bool; };
template<> struct enable_if<false> { };
template<typename C>
class pair
{
template<typename D>
using constraint = cond<trait<D>>;
template<typename E, typename enable_if<constraint<E>::value>::type = true>
pair(E&&) { }
};
pair<int> p(1);
GCC prints:
name.C:18:14: error: 'pair<C>::pair(E&&) [with E = int; typename
enable_if<cond<trait<D> >::value>::type <anonymous> = true; C = int]' is
private within this context
18 | pair<int> p(1);
| ^
name.C:15:5: note: declared private here
15 | pair(E&&) { }
| ^~~~
Why does it show cond<trait<D>> in the error? There is no D in that
constructor's parameter list, and D is not explained in the [with ...] template
arg list.
I think it should be shown as constraint<E> or as cond<trait<E>>, but showing D
is just confusing.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104094] Alias template shown in diagnostic with wrong template parameter name
2022-01-18 13:22 [Bug c++/104094] New: Alias template shown in diagnostic with wrong template parameter name redi at gcc dot gnu.org
@ 2022-01-19 0:50 ` pinskia at gcc dot gnu.org
2024-01-17 11:19 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-19 0:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104094
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-01-19
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104094] Alias template shown in diagnostic with wrong template parameter name
2022-01-18 13:22 [Bug c++/104094] New: Alias template shown in diagnostic with wrong template parameter name redi at gcc dot gnu.org
2022-01-19 0:50 ` [Bug c++/104094] " pinskia at gcc dot gnu.org
@ 2024-01-17 11:19 ` redi at gcc dot gnu.org
2024-01-20 18:46 ` pinskia at gcc dot gnu.org
2024-01-20 20:39 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-17 11:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104094
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2022-01-19 00:00:00 |2024-1-17
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Another example with recent trunk:
In file included from
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/std/text_encoding/requirements.cc:20:
/home/jwakely/gcc/14/include/c++/14.0.1/ranges: In function 'constexpr _Cont
std::ranges::to(_Rg&&, _Args&& ...)':
/home/jwakely/gcc/14/include/c++/14.0.1/ranges:9332:21: warning: typedef 'using
_RefT = std::ranges::range_reference_t<_Pattern>' locally defined but not used
[-Wunused-local-typedefs]
9332 | using _RefT = range_reference_t<_Rg>;
| ^~~~~
Where does _Pattern come from? There is no _Pattern in that function template.
The source line shows it should be range_reference_t<_Rg> instead.
_Pattern is used in lazy_split_view, split_view and join_view, none of which
are used at all by `ranges::to`. Is there some has collision going on here when
the pretty printer finds names? Does it need an additional disambiguation step
if more than one name is found?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104094] Alias template shown in diagnostic with wrong template parameter name
2022-01-18 13:22 [Bug c++/104094] New: Alias template shown in diagnostic with wrong template parameter name redi at gcc dot gnu.org
2022-01-19 0:50 ` [Bug c++/104094] " pinskia at gcc dot gnu.org
2024-01-17 11:19 ` redi at gcc dot gnu.org
@ 2024-01-20 18:46 ` pinskia at gcc dot gnu.org
2024-01-20 20:39 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 18:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104094
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> _Pattern is used in lazy_split_view, split_view and join_view, none of which
> are used at all by `ranges::to`. Is there some has collision going on here
> when the pretty printer finds names? Does it need an additional
> disambiguation step if more than one name is found?
Maybe that is PR 66968 (or PR 99) which I see are already linked here?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104094] Alias template shown in diagnostic with wrong template parameter name
2022-01-18 13:22 [Bug c++/104094] New: Alias template shown in diagnostic with wrong template parameter name redi at gcc dot gnu.org
` (2 preceding siblings ...)
2024-01-20 18:46 ` pinskia at gcc dot gnu.org
@ 2024-01-20 20:39 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-20 20:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104094
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yeah, maybe this is just a dup of my older bug report. It's been frustrating me
for years.
And obviously I meant "hash collision" above not "has collision" :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-20 20:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 13:22 [Bug c++/104094] New: Alias template shown in diagnostic with wrong template parameter name redi at gcc dot gnu.org
2022-01-19 0:50 ` [Bug c++/104094] " pinskia at gcc dot gnu.org
2024-01-17 11:19 ` redi at gcc dot gnu.org
2024-01-20 18:46 ` pinskia at gcc dot gnu.org
2024-01-20 20:39 ` 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).