Fixed compilation error on RHEL 5.10.

Nesting the namespace "Internal" inside of other namespaces and using
sequential "using namespace" directives *or* relying on a "using
namespace" directive to resolve a method name that contained the
"Internal" namespace for resolution resulted in ambiguous resolution
errors when compiling with the RHEL5.10 stock compiler (GCC 4.1.2).  A
sample error is provided below:

Compilation error encountered was:
reference to 'Internal' is ambiguous
/usr/lib/gcc/x86_64-redhat-
candidates are: namespace Internal { }
qt-creator/src/libs/cplusplus/PPToken.h:106: error:
namespace CPlusPlus::Internal { }

Modifying the using namespace directives to reflect the nested nature of
the namespace names resolved the compilation errors.  For example:

using namespace CppEditor;
using namespace Internal;

produced errors.  However,

using namespace CppEditor;
using namespace CppEditor::Internal;

resolved the compilation errors by removing the ambiguity.

Change-Id: I6d5051e20acb2c147bd7ee1c6c6e1e3b2b4ff0f9
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Dale Marchand
2014-06-17 17:41:39 -07:00
committed by Erik Verbruggen
parent 6fd6291ac8
commit ff52061e52
5 changed files with 6 additions and 5 deletions

View File

@@ -32,6 +32,7 @@
#include <cstring> #include <cstring>
using namespace CPlusPlus; using namespace CPlusPlus;
using namespace CPlusPlus::Internal;
bool ByteArrayRef::startsWith(const char *s) const bool ByteArrayRef::startsWith(const char *s) const
{ {
@@ -52,7 +53,7 @@ int ByteArrayRef::count(char ch) const
return num; return num;
} }
void Internal::PPToken::squeezeSource() void PPToken::squeezeSource()
{ {
if (hasSource()) { if (hasSource()) {
m_src = m_src.mid(offset, f.length); m_src = m_src.mid(offset, f.length);

View File

@@ -42,7 +42,7 @@
#include <QQueue> #include <QQueue>
using namespace CppEditor; using namespace CppEditor;
using namespace Internal; using namespace CppEditor::Internal;
using namespace CPlusPlus; using namespace CPlusPlus;
namespace { namespace {

View File

@@ -50,7 +50,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
using namespace CppEditor; using namespace CppEditor;
using namespace Internal; using namespace CppEditor::Internal;
using namespace Utils; using namespace Utils;
namespace CppEditor { namespace CppEditor {

View File

@@ -42,7 +42,7 @@
#include <QCoreApplication> #include <QCoreApplication>
using namespace CppEditor; using namespace CppEditor;
using namespace Internal; using namespace CppEditor::Internal;
CppSnippetProvider::CppSnippetProvider() : CppSnippetProvider::CppSnippetProvider() :
TextEditor::ISnippetProvider() TextEditor::ISnippetProvider()

View File

@@ -44,7 +44,7 @@
#include <QLabel> #include <QLabel>
using namespace CppEditor; using namespace CppEditor;
using namespace Internal; using namespace CppEditor::Internal;
using namespace Utils; using namespace Utils;
namespace { namespace {