Bug 26470 - correct code doesn't compile (global namespace qualification)
Summary: correct code doesn't compile (global namespace qualification)
Status: RESOLVED DUPLICATE of bug 26468
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-25 19:29 UTC by o.kullmann
Modified: 2006-02-25 19:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description o.kullmann 2006-02-25 19:29:05 UTC
#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: &#8216;struct std::string::N&#8217; has not been declared
GCC_Fehler_25022006.cpp:6: error: ISO C++ forbids declaration of &#8216;s&#8217; with no type
GCC_Fehler_25022006.cpp: In function &#8216;int N::s()&#8217;:
GCC_Fehler_25022006.cpp:6: error: invalid conversion from &#8216;const char*&#8217; to &#8216;int&#8217;

But I believe the above code is correct. Changing ::N::X::s() to N::X::s()
makes the code compile.
Comment 1 Andrew Pinski 2006-02-25 19:33:02 UTC

*** This bug has been marked as a duplicate of 26468 ***