This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25867] New: g++ messes up member operator with friend operator in spite of having arguments of different types
- From: "relf at os2 dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jan 2006 04:09:17 -0000
- Subject: [Bug c++/25867] New: g++ messes up member operator with friend operator in spite of having arguments of different types
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
g++ 4.0.3 as well as g++-3.4 fails to compile the attached program b.cpp with
the following errors:
b.cpp:12: error: declaration of 'operator-' as non-function
b.cpp:12: error: expected ';' before '<' token
Things become even worse if we make int x; private in class A (see b2.cpp).
g++ 4.0.3 starts complaining:
b2.cpp:12: error: declaration of 'operator-' as non-function
b2.cpp:12: error: expected ';' before '<' token
b2.cpp: In function 'A<n> operator-(const A<n>&, const A<n>&) [with int n =
0]':
b2.cpp:18: instantiated from here
b2.cpp:7: error: 'int A<0>::x' is private
b2.cpp:23: error: within this context
b2.cpp:7: error: 'int A<0>::x' is private
b2.cpp:23: error: within this context
b2.cpp:7: error: 'int A<0>::x' is private
b2.cpp:23: error: within this context
g++ 3.3 compiles both b.cpp and b2.cpp without a single warning. So I believe
this is a regression.
--
Summary: g++ messes up member operator with friend operator in
spite of having arguments of different types
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: relf at os2 dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25867