[llvm-bugs] [Bug 26738] New: clang-cl fails to compile atlctrlw.h header from WTL
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 25 06:26:40 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26738
Bug ID: 26738
Summary: clang-cl fails to compile atlctrlw.h header from WTL
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: andreybokhanko at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
A small reproducer is:
class CCommandBarCtrlImpl {
public:
enum { _nMaxMenuItemTextLength = 100 };
};
void foo(CCommandBarCtrlImpl *pT) {
char szString[pT->_nMaxMenuItemTextLength] = { 0 };
}
$ clang-cl H:/aero.cpp -c
H:/aero.cpp(7,17) : error: variable-sized object may not be initialized
char szString[pT->_nMaxMenuItemTextLength] = { 0 };
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Both MS and GCC compilers compile the test fine:
$ cl H:/aero.cpp -c
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
aero.cpp
$ echo $?
0
This construct is used in atlctrlw.h header from Windows Template Library:
(https://sourceforge.net/p/wtl/code/HEAD/tree/trunk/wtl/Include/atlctrlw.h#l1309):
TCHAR szString[pT->_nMaxMenuItemTextLength] = { 0 };
nMaxMenuItemTextLength is defined at line 239 of the same header:
enum
{
_nMaxMenuItemTextLength = 100,
_chChevronShortcut = _T('/')
};
Yours,
Andrey
======
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/20160225/042ac555/attachment.html>
More information about the llvm-bugs
mailing list