[llvm-bugs] [Bug 31903] New: Clang-CL error on inheritance from template supplied internal type

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 8 09:20:39 PST 2017


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: unassignedclangbugs at nondot.org
          Reporter: steveire at gmail.com
                CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170208/0a7107c2/attachment-0001.html>


More information about the llvm-bugs mailing list