This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ bug 764


Nathan Sidwell <nathan@codesourcery.com> writes:

| Hi,
| In reexamining bug 764, I'm not convinced the code is well-formed.

Well, I think the code (the example you posted below) is well-formed
and the compiler is behaving in a non-conformant way.

| (Martin, we may have corresponded on this, but I cannot find any of
| that email).
| 
| The code in question is this [note, that this is in a follow up, as the
| original bug report code wasn't what martin intended]
| 
| template <class T>
|  struct S
|  {
|      friend bool operator== (const S&, const S&) {
|          return true;
|      }
|  };
|  
|  int main ()
|  {
|      // S<int> s;
|  
|      const S<int> *p = 0;

Right now, just instantiating the name declaration S<int> is sufficient.

|      *p == *p; // error

At this point, we need to instantiate the class S<int> in order to
form the overload set.  See 13.3.1.2/3.

|  }
|  
| g++ says,
| 
| test.cpp: In function `int main()':
| test.cpp:33: no match for `const S<int> & == const S<int> &'

This is boggus.

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]