https://llvm.org/bugs/show_bug.cgi?id=27733
Bug ID: 27733 Summary: [ms] clang-cl fails to compile WTL header "atlctrlx.h" and several related samples Product: clang Version: trunk Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: C++ Assignee: unassignedclangb...@nondot.org Reporter: ku...@list.ru CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified !- This problem was found in WTL Sample TabBrowser but affects most all samples. It also affects a compilation of WTL header atlctrlx.h, microsoft correctly compiles such code. Seems that clang incorrectly parses this header. In small reproducer section you can see a code that is reduced and is using only headers from VS (including ATL) without using any headers from WTL -! ===========Environment=============== OS: Win Language: c++ Version: trunk [3.8] ===========How To Reproduce=========== >>> 1) Download WTL from here: https://sourceforge.net/projects/wtl/ to [WTL_HOME] 2) Goto [WTL_HOME]/Samples/TabBrowser 3) clang-cl -c -D "_UNICODE" -D "UNICODE" -I ../../include -w TabBrowser.cpp >>> or download and compile code below ( includes were reduced a lot - see small reproducer): //these headers are from WTL library (they are not included inside VS package) #include <atlbase.h> #include <atlapp.h> #include <atlctl.h> #include <atlctrls.h> #include <atlctrlx.h> using: clang-cl -c -D "_UNICODE" -D "UNICODE" -I ../include -w test.cpp ==========Small Reproducer============= //no need to download anything - these headers are from MSVS #include <basetsd.h> #include <atlbase.h> #include <atlwin.h> class CPaintDC{ public: HWND m_hWnd; // this name is unknown in OnPaint function CPaintDC(HWND hWnd){} }; template <class TBase> class CButtonT : public TBase{ public: CButtonT() {} }; typedef CButtonT<ATL::CWindow> CButton; template <class T, class TBase = CButton> class CBitmapButtonImpl : public ATL::CWindowImpl < T >{ public: CBitmapButtonImpl() {} int ProcessWindowMessage(HWND hWnd, unsigned int uMsg, UINT_PTR wParam, LONG_PTR lParam, LRESULT& lResult, DWORD dwMsgMapID = 0){ OnPaint(uMsg, wParam, lParam); return 0; } void OnPaint(unsigned int, WPARAM wParam, LPARAM){ CPaintDC dc(m_hWnd); // ERROR appears here, note also, that compiler incorrectly parse a statement and thinks that m_hWnd is a type <<< } }; class CBitmapButton : public CBitmapButtonImpl < CBitmapButton >{ public: CBitmapButton() : CBitmapButtonImpl<CBitmapButton>() {} }; ===============Error================== >>>clang-cl: test.cpp(30,40) : error: unknown type name 'm_hWnd' CPaintDC dc(m_hWnd); ^ test.cpp(37,14) : note: in instantiation of member function 'CBitmapButtonImpl<CBitmapButton, CButtonT<ATL::CWindow> >::ProcessWindowMessage' requested here CBitmapButton() : CBitmapButtonImpl<CBitmapButton>() {} ^ test.cpp(30,39) : warning: parentheses were disambiguated as a function declaration [-Wvexing-parse] CPaintDC dc(m_hWnd); ^~~~~~~~ test.cpp(30,40) : note: add a pair of parentheses to declare a variable CPaintDC dc(m_hWnd); >>>msvc: no diagnostics Andrey Kuleshov ====== Software Engineer Intel Compiler Team -- 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