Discussion: Valid C++?
Afficher un message
Vieux 17/10/2007, 11h15   #1
Boris
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Valid C++?

Is this a valid C++ program (according to the C++ standard)? I ask as I'm
trying to port a Windows library to Solaris, and the Solaris C++ compiler
reports an error (The name x is ambiguous in ns1: ns2::x and ns1::x). The
code below reproduces the problem, and I wonder now if I have to adapt the
code or submit a bug report to Sun?

namespace ns1 {
struct x { };
}

namespace ns2 {
using namespace ns1; // If this line is removed ...
void x(); // ... or this line the code compiles.
struct x { };
}

int main()
{
struct ns2::x x;
}
  Réponse avec citation
 
Page generated in 0,06489 seconds with 9 queries