tags:

views:

74

answers:

2

I have successfully constructed something similar to the following code in visual studio 2008:

class OpDevconfigSession;
class DevconfigSession
{
... 
private
   friend class OpDevconfigSession;
};

Again, this works quite well with visual studio. However, if I try to compile the code under g++ version 4.3.2, I get an error message such as:

error: friend declaration does not name a class or function

I know that standards conformance is not Microsoft's forte so I am wondering if the code that I have written breaks with the standard in some way that I do not yet understand. Does anyone have any thoughts?

Thanks

+7  A: 
Steve M
You mean a colon, not semicolon, I think...
Nick
Good eye. Thanks.
Steve M
yeah, the missing colon was a transcription error on my part. I take it, then, that this is a bug that has since been fixed in g++.
Jon Trauntvein
+1  A: 

The following work for me in g++ ver 4.4.1.

class OpDevconfigSession;
class DevconfigSession
{
  private:
   friend class OpDevconfigSession;
};

I can't see why this might be illegal.

ArunSaha