public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57311] New: Conversion operator can be overloaded with itself by using typedef
@ 2013-05-17 10:04 redi at gcc dot gnu.org
2013-05-17 10:13 ` [Bug c++/57311] " redi at gcc dot gnu.org
2021-08-02 0:46 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-17 10:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57311
Bug ID: 57311
Summary: Conversion operator can be overloaded with itself by
using typedef
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
This should be rejected:
typedef int Int;
template<class T, class U> struct is_same { enum { value = 0 }; };
template<class T> struct is_same<T, T> { enum { value = 1 }; };
struct X
{
operator int() const { return 0; }
operator Int() const { return 0; }
};
static_assert( is_same<Int, int>::value, "Int is int" );
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/57311] Conversion operator can be overloaded with itself by using typedef
2013-05-17 10:04 [Bug c++/57311] New: Conversion operator can be overloaded with itself by using typedef redi at gcc dot gnu.org
@ 2013-05-17 10:13 ` redi at gcc dot gnu.org
2021-08-02 0:46 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-17 10:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57311
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If the definitions are not inline G++ spots the problems:
typedef int Int;
struct X
{
operator int() const;
operator Int() const;
};
X::operator int() const { return 0; }
X::operator Int() const { return 0; }
x.cc:10:1: error: redefinition of 'X::operator Int() const'
X::operator Int() const { return 0; }
^
x.cc:9:1: error: 'X::operator int() const' previously defined here
X::operator int() const { return 0; }
^
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/57311] Conversion operator can be overloaded with itself by using typedef
2013-05-17 10:04 [Bug c++/57311] New: Conversion operator can be overloaded with itself by using typedef redi at gcc dot gnu.org
2013-05-17 10:13 ` [Bug c++/57311] " redi at gcc dot gnu.org
@ 2021-08-02 0:46 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02 0:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57311
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
Target Milestone|--- |8.0
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 8, I suspect by r8-2669 or r8-2664.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-02 0:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-17 10:04 [Bug c++/57311] New: Conversion operator can be overloaded with itself by using typedef redi at gcc dot gnu.org
2013-05-17 10:13 ` [Bug c++/57311] " redi at gcc dot gnu.org
2021-08-02 0:46 ` 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).