https://llvm.org/bugs/show_bug.cgi?id=31903

            Bug ID: 31903
           Summary: Clang-CL error on inheritance from template supplied
                    internal type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: steve...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

MS CL.exe differs in behavior from Clang-CL

$ type ..\templ_inst.cpp

namespace {
class Internal {};
}

class __declspec(dllexport) NotTempl : public Internal
{
};

template<typename T>
class __declspec(dllexport) Templ : public T
{
};

int main()
{
        NotTempl nt;
        Templ<Internal> ta;

        return 0;
}

$ C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe ..\templ_inst.cpp
..\templ_inst.cpp(11,29):  error: 'Templ<(anonymous namespace)::Internal>' must
have external linkage when declared 'dllexport'
class __declspec(dllexport) Templ : public T
                            ^
..\templ_inst.cpp(18,18):  note: in instantiation of template class
'Templ<(anonymous namespace)::Internal>' requested here
        Templ<Internal> ta;
                        ^
1 error generated.

$ CL.exe ..\templ_inst.cpp
/out:templ_inst.exe
templ_inst.obj
   Creating library templ_inst.lib and object templ_inst.exp

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to