[Bug c++/26468] New: correct code doesn't compile (global namespace qualification)

o dot kullmann at swansea dot ac dot uk gcc-bugzilla@gcc.gnu.org
Sat Feb 25 19:17:00 GMT 2006


#include <string>
namespace N {
  struct X { static std::string s(); };
}
namespace N {
  inline std::string ::N::X::s() { return ""; }
}
int main() {}

compiled with version 3.4.3 or 4.0.2 yields
GCC_Fehler_25022006.cpp:6: error: ‘struct std::string::N’ has not
been declared
GCC_Fehler_25022006.cpp:6: error: ISO C++ forbids declaration of
‘s’ with no type
GCC_Fehler_25022006.cpp: In function ‘int N::s()’:
GCC_Fehler_25022006.cpp:6: error: invalid conversion from ‘const
char*’ to ‘int’

But I believe the above code is correct. Changing ::N::X::s() to N::X::s()
makes the code compile.


-- 
           Summary: correct code doesn't compile (global namespace
                    qualification)
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: o dot kullmann at swansea dot ac dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26468



More information about the Gcc-bugs mailing list