Topic: Multiple friend declarations


Author: kocher@us-es.sel.de (Hartmut Kocher)
Date: Thu, 23 Dec 93 15:07:10 GMT
Raw View
Is the following legal C++ code?

class X {
  friend class Y;
  friend class Y;

public:
  X() : i(0) {}

  int i;
};

Greenhills C++ rejected the duplicate friend declaration. Other compilers
don't complain. Is is defined in the ARM how often such a declaration
may appear within a class declaration? I didn't find anything specific.
If I take the same approach as with forward declarations this should
be legal (although it doesn't make a lot of sense, but that's another
story).

Is this a compiler bug?
Thanks for your help
Hartmut

--
+==============================|==============================+
| Hartmut Kocher               |                              |
| Technical Consultant         | All opinions expressed here  |
| Rational GmbH                | are my own.                  |
| Rosenstrasse 7               |                              |
| 82049 Pullach im Isartal     | I know you guessed it,       |
| Germany                      | but it keeps my lawyer happy.|
| Email: hwk@rational.com      |                              |
+==============================|==============================+