[LLVMbugs] [Bug 15012] New: specialization in different namespace

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 20 14:50:07 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15012

             Bug #: 15012
           Summary: specialization in different namespace
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: brooks.brian at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


> cat tmp.cc
#include <utility>
#include <unordered_map>

using namespace std;

template <typename T, typename U>
struct hash<pair<T, U> > {
 public:
  size_t operator()(pair<T, U> x) const throw() {
    return hash<T>()(x.first) ^ hash<U>()(x.second);
  }
};

int main(int argc, char *argv[]) {
  return 0;
}
> clang++ tmp.cc -std=c++0x
> g++ tmp.cc -std=c++0x
tmp.cc:7:8: error: specialization of ‘template<class _Tp> struct std::hash’ in
different namespace [-fpermissive]
/usr/include/c++/4.6/bits/functional_hash.h:58:12: error:   from definition of
‘template<class _Tp> struct std::hash’ [-fpermissive]

> g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

clang at r171683 (2013-01-06)

Can someone who is familiar with the standard point out where this behavior
would be defined?

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list