[llvm-bugs] [Bug 27337] New: [ms] clang-cl fails to compile sample MDIDocVw from WTL (header atlframe.h)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 13 06:02:26 PDT 2016


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

            Bug ID: 27337
           Summary: [ms] clang-cl fails to compile sample MDIDocVw from
                    WTL (header atlframe.h)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.kuleshov at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

!- compilation of WTL example WTL/MDIDocVw fails with clang. MS can compile the
whole project without any errors.
These problems also appear during compilation of this sample:
26735
26748
-!

========Environment==============
Os: Win
Language: C++
Version: trunk

========Reproducer================

1) Download WTL from here: https://sourceforge.net/projects/wtl/ to [WTL_HOME] 
2) Goto [WTL_HOME]/Samples/MDIDocVw 
3) clang-cl -c -D "_UNICODE" -D "UNICODE" -I ../../include  -w MDI.cpp

========Small Reproducer==========
/*code from include/atlframe.h*/
template <class T>
class CUpdateUI
{
public:
        CUpdateUI()
        {
                T* pT = static_cast<T*>(this);
        }
};

/*code from sample WTL/MDIDocVw (mainfrm.h )*/
class CMDIFrame :  CUpdateUI<CMDIFrame>
{
public:

        virtual int DoUpdate()
        {
           return 0;
        }
};

/* default constructor is called in MDI.cpp*/
int main (){
        CMDIFrame wndMain;
return 0;
}

=============Error==================
>>> clang: 
error: cannot cast private base class 'CUpdateUI<CMDIFrame>' to 'CMDIFrame'
                T* pT = static_cast<T*>(this);
                        ^
note: in instantiation of member function 'CUpdateUI<CMDIFrame>::CUpdateUI'
requested here
class CMDIFrame :  CUpdateUI<CMDIFrame>
      ^
note: implicitly declared private here
class CMDIFrame :  CUpdateUI<CMDIFrame>
                   ^~~~~~~~~~~~~~~~~~~~
>>> msvc: no diag

>>> gcc: 
error: ‘CUpdateUI<CMDIFrame>’ is an inaccessible base of ‘CMDIFrame’
                 T* pT = static_cast<T*>(this);


Andrey Kuleshov
======
Software Engineer
Intel Compiler Team

-- 
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/20160413/f76eb73a/attachment.html>


More information about the llvm-bugs mailing list