Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ms] clang-cl fails to compile sample MDIDocVw from WTL (header atlframe.h) #27711

Closed
llvmbot opened this issue Apr 13, 2016 · 6 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" wontfix Issue is real, but we can't or won't fix it. Not invalid

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 13, 2016

Bugzilla Link 27337
Resolution WONTFIX
Resolved on Nov 07, 2018 00:21
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @dmpolukhin,@zygoloid

Extended Description

!- 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 CUpdateUI
{
public:
CUpdateUI()
{
T* pT = static_cast<T*>(this);
}
};

/code from sample WTL/MDIDocVw (mainfrm.h )/
class CMDIFrame : CUpdateUI
{
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' to 'CMDIFrame'
T* pT = static_cast<T*>(this);
^
note: in instantiation of member function 'CUpdateUI::CUpdateUI' requested here
class CMDIFrame : CUpdateUI
^
note: implicitly declared private here
class CMDIFrame : CUpdateUI
^~~~~~~~~~~~~~~~~~~~
msvc: no diag

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

Andrey Kuleshov

Software Engineer
Intel Compiler Team

@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 13, 2016

assigned to @dmpolukhin

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Apr 14, 2016

The code is obviously ill-formed; the question is, does it make sense for us to be compatible with this MSVC bug?

If this only occurs in sample code, that doesn't seem like a very compelling case to me. If this also occurs in a large quantity of real code derived from those samples, that would be more persuasive.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Apr 14, 2016

Also, have you contacted the authors of this code to let them know their samples are broken?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 14, 2016

Also, have you contacted the authors of this code to let them know their
samples are broken?

Actually not, I just wanted to know whether clang can compile WTL/ATL headers.
And the only way to check templates was to compile samples where they have instantiation. Probably after a check of all samples I will report such problems to authors.

The code is obviously ill-formed; the question is, does it make sense for us
to be compatible with this MSVC bug?

If this only occurs in sample code, that doesn't seem like a very compelling
case to me. If this also occurs in a large quantity of real code derived
from those samples, that would be more persuasive.

Yes, I understand that such code has no sense and I'm ok with closing PR as Resolved Invalid. But anyway I wanted to report that there is ms bug that allows users to compile code from real samples that clang is not able to compile.
I've checked a half of samples that are in WTL and this problem appears only in this one sample.

@dmpolukhin
Copy link
Contributor

Fixed by http://reviews.llvm.org/D19477

@dmpolukhin
Copy link
Contributor

Reverted by r267865.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@Quuxplusone Quuxplusone added the wontfix Issue is real, but we can't or won't fix it. Not invalid label Jan 20, 2022
trevor-m pushed a commit to trevor-m/llvm-project that referenced this issue Apr 20, 2023
/Gr), by Alexander Makarov

Patch for bug llvm#27711
Differential Revision: http://reviews.llvm.org/D20171

llvm-svn: 269891
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" wontfix Issue is real, but we can't or won't fix it. Not invalid
Projects
None yet
Development

No branches or pull requests

3 participants