C++ compiler bug? 
Author Message
 C++ compiler bug?

The following fails to compile in Visual Studio .Net 2003
beta:

namespace n
{
   void f();
   void g();
   void g(int);

Quote:
}

void n::f()
{
   struct s
   {
      void m()
      {
         g();        // error C2326: cannot access N::g
         n::g();     // but this is fine
         using n::g;
         g();        // ans so is this
      }
   };

Quote:
}

Notice that g() is overloaded; removing the overload also
fixes the problem.

Is this a bug in the new compiler (to do with Koenig
lookup), or have i misundestood the rules of the C++
language. Note that this problem is particularly annoying
when g() is in fact operator<< (which if course is heavily
overloaded).

regards,

jonathon



Tue, 23 Aug 2005 00:08:33 GMT  
 C++ compiler bug?

Quote:

> Is this a bug in the new compiler (to do with Koenig
> lookup), or have i misundestood the rules of the C++
> language. Note that this problem is particularly annoying
> when g() is in fact operator<< (which if course is heavily
> overloaded).

Looks like a bug to me.  Comeau compiles your sample without warning or
error.  VC7.1 RC3 produces the same error you mentioned.  Consider it
submitted to the beta bug database.

-cd



Tue, 23 Aug 2005 02:30:15 GMT  
 C++ compiler bug?

--------------------

Quote:
>Content-Class: urn:content-classes:message


>Subject: C++ compiler bug?
>Date: Thu, 6 Mar 2003 08:08:33 -0800
>Is this a bug in the new compiler (to do with Koenig
>lookup), or have i misundestood the rules of the C++
>language. Note that this problem is particularly annoying
>when g() is in fact operator<< (which if course is heavily
>overloaded).

>regards,

>jonathon

Jonathon, as Carl confirmed, this is a bug.  Thank you for reporting it.  
Unfortunately, it won't be fixed for Visual Studio .Net 2003.

--
Arjun Bijanki, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.



Tue, 23 Aug 2005 03:17:33 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VC7 adds a new twist to an old C++ compiler bug

2. C++ compiler bug: template and non template function overload resolution

3. possible VS.NET C++ compiler bug

4. Visual C++ compiler bug

5. Visual C++ compiler bug

6. VS.Net C++ Compiler Bug

7. VC7 adds a new twist to an old C++ compiler bug

8. Yet another Visual C++ compiler bug. . .

9. C++ compiler of VC.NET (Bugs)

10. Bug in Visual C++ 7.1 Final Beta compiler.

11. Another C++ floating-point compiler bug

12. Visual C++ - possible compiler bug - simple, interesting...

 

 
Powered by phpBB® Forum Software