[LLVMbugs] [Bug 10521] New: libc++ problem: implicit instantiation of undefined template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 28 04:37:48 PDT 2011


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

           Summary: libc++ problem: implicit instantiation of undefined
                    template
           Product: libc++
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: dmarkman at mac.com
                CC: llvmbugs at cs.uiuc.edu


I was playing with Xcode 4.2 on Lion
my clang++ version is
Apple clang version 3.0 (tags/Apple/clang-210.3) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.0.0
Thread model: posix

consider the following code
(it was boiled down from some boost related code)

#include <utility>

namespace std {
    template <typename T1, typename T2> struct pair;
}

int main (int argc, const char * argv[])
{
    std::pair <int, int> p;
    return 0;
}


g++ (4.2.1) compiler doesn't complain:

however clang++ with the following command line complains:

clang++ -std=c++0x -stdlib=libc++ -c main.cpp 
main.cpp:10:26: error: implicit instantiation of undefined template
'std::pair<int, int>'
    std::pair <int, int> p;
                         ^
main.cpp:5:48: note: template is declared here
    template <typename T1, typename T2> struct pair;
                                               ^
1 error generated.


if I don't use the switch -stdlib=libc++ there is no error

also

if I place 

namespace std {
    template <typename T1, typename T2> struct pair;
}

before

#include <utility>


namespace std {
    template <typename T1, typename T2> struct pair;
}

#include <utility>

int main (int argc, const char * argv[])
{
    std::pair <int, int> p;
    return 0;
}


then everything is fine even with -stdlib=libc++

thanks

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