public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107771] New: Cannot resolve templated conversion operator in templated struct
@ 2022-11-20 18:36 alvinhochun at gmail dot com
2022-11-20 19:28 ` [Bug c++/107771] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: alvinhochun at gmail dot com @ 2022-11-20 18:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107771
Bug ID: 107771
Summary: Cannot resolve templated conversion operator in
templated struct
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: alvinhochun at gmail dot com
Target Milestone: ---
With this code:
===
template <typename T>
struct bind_in
{
bind_in(T const& object) noexcept : object(object) {}
T const& object;
template <typename R>
operator R const& () const noexcept {
return reinterpret_cast<R const&>(object);
}
};
struct SomeType {
int v;
};
void func(SomeType in);
void x(const SomeType& v) {
func(bind_in(v));
}
===
GCC produces an error:
error: could not convert 'bind_in<SomeType>((* & v))' from 'bind_in<SomeType>'
to 'SomeType'
Compiler Explorer: https://godbolt.org/z/rrhY7rr3b
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/107771] Cannot resolve templated conversion operator in templated struct
2022-11-20 18:36 [Bug c++/107771] New: Cannot resolve templated conversion operator in templated struct alvinhochun at gmail dot com
@ 2022-11-20 19:28 ` pinskia at gcc dot gnu.org
2022-11-20 19:29 ` pinskia at gcc dot gnu.org
2022-11-20 19:30 ` [Bug c++/107771] template const reference conversion operator not considered pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-20 19:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107771
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
struct bind_in
{
template <typename R>
operator R const& () const;
}a;
int x(void) {
return a;
}
```
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/107771] Cannot resolve templated conversion operator in templated struct
2022-11-20 18:36 [Bug c++/107771] New: Cannot resolve templated conversion operator in templated struct alvinhochun at gmail dot com
2022-11-20 19:28 ` [Bug c++/107771] " pinskia at gcc dot gnu.org
@ 2022-11-20 19:29 ` pinskia at gcc dot gnu.org
2022-11-20 19:30 ` [Bug c++/107771] template const reference conversion operator not considered pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-20 19:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107771
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-11-20
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/107771] template const reference conversion operator not considered
2022-11-20 18:36 [Bug c++/107771] New: Cannot resolve templated conversion operator in templated struct alvinhochun at gmail dot com
2022-11-20 19:28 ` [Bug c++/107771] " pinskia at gcc dot gnu.org
2022-11-20 19:29 ` pinskia at gcc dot gnu.org
@ 2022-11-20 19:30 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-20 19:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107771
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 61663.
*** This bug has been marked as a duplicate of bug 61663 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-20 19:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 18:36 [Bug c++/107771] New: Cannot resolve templated conversion operator in templated struct alvinhochun at gmail dot com
2022-11-20 19:28 ` [Bug c++/107771] " pinskia at gcc dot gnu.org
2022-11-20 19:29 ` pinskia at gcc dot gnu.org
2022-11-20 19:30 ` [Bug c++/107771] template const reference conversion operator not considered pinskia 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).