[LLVMbugs] [Bug 6918] New: clang++: lazy instantiation issue?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 24 05:25:24 PDT 2010


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

           Summary: clang++: lazy instantiation issue?
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
            Blocks: 6916


This code compiles with g++, but not with clang++:

$ cat >test.cpp <<EOF
template <class Scalar>
inline bool equal(const Scalar &v, const Scalar &c)
{
  return ABS(v-c);
}
template < class T >
inline T
ABS( T a )
{ return (0 < a) ? a : -a ; }


int main()
{
    float a, b;
    equal(a,b);
}
EOF

$ clang++ test.cpp
x.cpp:5:10: error: use of undeclared identifier 'ABS'
  return ABS(v-c);
         ^
x.cpp:16:5: note: in instantiation of function template specialization
'equal<float>' requested here
    equal(a,b);
    ^
2 diagnostics generated.


This occurs when building blender 2.49b:
/home/edwin/clangtests/blender-2.49b/intern/elbeem/intern/ntl_vector3dim.h:998:11:
error: use of undeclared identifier 'ABS'
  return (ABS(v[0]-c[0]) +
          ^
/home/edwin/clangtests/blender-2.49b/intern/elbeem/intern/ntl_bsptree.cpp:192:7:
note: in instantiation of function template
      specialization 'equal<float>' requested here
                if( equal(triangleNormal, ntlVec3Gfx(0.0)) ) continue;
                    ^
2 diagnostics generated.

-- 
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