[LLVMbugs] [Bug 7185] New: template evaluated to early

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 21 02:55:33 PDT 2010


           Summary: template evaluated to early
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: niebuhr at niebuhrt.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

I am not sure if this is a bug.
Given the code below, clang states that the function hash is not know. But
doesn't the C++ standard say, that template expressions are only evaluated
where they are used?
And since the functions are defined below, the compiler shouldn't complain.

Remark: This code snippet is from the pocolib project.

template <class T>
struct Hash
        /// A generic hash function.
        std::size_t operator () (T value) const
                /// Returns the hash for the given value.
                return hash(value);

std::size_t Foundation_API hash(Int8 n);
std::size_t Foundation_API hash(UInt8 n);
std::size_t Foundation_API hash(Int16 n);
std::size_t Foundation_API hash(UInt16 n);
std::size_t Foundation_API hash(Int32 n);
std::size_t Foundation_API hash(UInt32 n);
std::size_t Foundation_API hash(Int64 n);
std::size_t Foundation_API hash(UInt64 n);
std::size_t Foundation_API hash(const std::string& str);


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