poxy icon indicating copy to clipboard operation
poxy copied to clipboard

Anonymous namespace within another namespace will duplicate top-level namespace

Open wroyca opened this issue 2 years ago • 1 comments

Environment

version and/or commit hash:

0.13.4

Describe the bug

Placing an anonymous namespace within another namespace will duplicate top-level namespace:

a.cxx:

namespace hello
{
  namespace
  {
    void
    say_hello (ostream& o, const string& n)
    {
      if (n.empty ())
        throw invalid_argument ("empty name");
  
      o << "Hello, " << n << '!' << endl;
    }
  }
}

b.cxx:

namespace hello
{
  namespace
  {
    void
    say_hello (ostream& o, const string& n)
    {
      if (n.empty ())
        throw invalid_argument ("empty name");
  
      o << "Hello, " << n << '!' << endl;
    }
  }
}

image

Additional information

It also becomes confused and duplicates elements, such as concept from a.cxx, within both namespaces.

image

wroyca avatar Aug 08 '23 17:08 wroyca

Additional context from discord:

This is specific to XML output, e.g. Doxygen HTML is fine in that regards.

wroyca avatar Aug 08 '23 17:08 wroyca

Thinking about this, I don't actually this is worth addressing, tbh. Anonymous namespaces are for implementation details in cpp files - running Doxygen over cpp files (i.e. not headers, but actual implementation source files) is unusual. A better fix for this would be simply to not run doxygen/poxy over cpp files at all

marzer avatar Aug 03 '24 14:08 marzer

Thinking about this, I don't actually this is worth addressing, tbh. Anonymous namespaces are for implementation details in cpp files - running Doxygen over cpp files (i.e. not headers, but actual implementation source files) is unusual. A better fix for this would be simply to not run doxygen/poxy over cpp files at all

Agree - Note that it was a long time ago, so I don't remember the context, but that may have been from playing with modules here (where the extension name is arbitrary with some build system)

wroyca avatar Aug 03 '24 14:08 wroyca

Closing :)

wroyca avatar Aug 03 '24 14:08 wroyca