Did a compiler ever resolve namespace ambiguities?

86 views Asked by At

I have to compile the code of tokumx from percona's github repository. It contains an ambiguity regarding the use of shared_ptr .

In short, the pattern is as follows:

namespace baz
{
    class integer;
}

namespace bar
{
    class integer;
}

namespace foo
{
    using namespace bar;
    using baz::integer;
}

namespace main
{
    using namespace foo;

    void f(const integer&);
}

Naturally, this won't compile. And I am not here to ask why, but rather to understand how this ever compiled in the first place and if I can trust that codebase at all. That code is from 2014 and C++11 was definitely a thing back then. My suspicion is that this code was never compiled with C++11 simply because the compilers did not default to that standard 5 years ago, is that correct?

  1. When (which gcc/clang version) was C++11 the default?
  2. Is there some magic compiler flag that would resolve the issue even with C++11?
  3. Now to the bonus question: If that software was never compiled with C++11 is it even safe to patch that particular spot or do I risk invisible changes in behavior that can lad to severe runtime errors? (By invisible I mean errors that do not occur at compile-time but rather changes in behavior that lead to errors at runtime like memory leaks or crashes.)
0

There are 0 answers