[LLVMbugs] [Bug 12635] New: clang fails to automatically instantiate a template member function when used as size for stack-based array

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 23 09:11:49 PDT 2012


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

             Bug #: 12635
           Summary: clang fails to automatically instantiate a template
                    member function when used as size for stack-based
                    array
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris.cleeland at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code fails to link with clang 3.0 release:


#include <set>
#include <iostream>

int main(int argc, char* argv[])
{
   std::set<unsigned long> m;

   m.insert(1);
   m.insert(2);

#ifdef FORCE_INSTANTIATION
   size_t msize = m.size();
#endif

   char s[m.size()];

   std::cout << "slen = " << sizeof(s) << std::endl;
}


because he compiler fails to properly instantiate std::set<unsigned
long>::size().  However, if compiled with -DFORCE_INSTANTIATION,
std::set<unsigned long>::size() gets properly instantiated and the code links.

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