[LLVMbugs] [Bug 15651] New: Clang fails to build a template that uses constexpr.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Apr 1 22:43:12 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15651
Bug ID: 15651
Summary: Clang fails to build a template that uses constexpr.
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: jujjyl at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 10275
--> http://llvm.org/bugs/attachment.cgi?id=10275&action=edit
-E -generated test case.
I have built Clang 3.2 on Windows following these instructions:
https://github.com/kripken/emscripten/wiki/Using-Emscripten-from-Visual-Studio-2010
(step 4 on that page)
Using that to build libcxx on Windows for emscripten, I am bit by an issue
where a constexpr inside a template class is not working.
The same code builds ok on Clang 3.2 built on Linux or OSX (following
instructions at
https://github.com/kripken/emscripten/wiki/Getting-started-on-Mac-OS-X and
https://github.com/kripken/emscripten/wiki/Getting-Started-on-Ubuntu-12.10 )
A large test case is available at
https://dl.dropbox.com/u/40949268/emcc/bugs/preprocessed.cpp
Compiling on Windows with "clang++ -std=c++11 -m32 -U__i386__ -U__x86_64__
-U__i386 -U__x86_64 -Ui386 -Ux86_64 -U__SSE__ -U__SSE2__ -U__MMX__
-UX87_DOUBLE_ROUNDING -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -U__STRICT_ANSI__
-U__CYGWIN__ -D__STDC__ -Xclang -triple=i386-pc-linux-gnu
-D__IEEE_LITTLE_ENDIAN -fno-math-errno -fno-ms-compatibility -nostdinc
-nostdinc++ -Xclang -nobuiltininc -Xclang -nostdsysteminc -U__APPLE__
-U__linux__ -emit-llvm -c preprocessed.cpp"
gives the error
clang++: warning: argument unused during compilation: '-nostdinc++'
G:\Inttel-slave\win-emcc-incoming-tests\build\system\lib\libcxx\condition_variable.cpp:59:30:
error: constexpr variable 'ts_sec_max' must be initialized by a constant
expression
_LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits::max();
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
G:\Inttel-slave\win-emcc-incoming-tests\build\system\lib\libcxx\condition_variable.cpp:59:43:
note: undefined function 'max' cannot be used in a constant expression
_LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits::max();
^
G:\Inttel-slave\win-emcc-incoming-tests\build\system\include\libcxx\limits:443:61:
note: declared here
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT
{return __base::max();}
^
1 error generated.
A minimal failing example that exhibits the same problem is available at
https://dl.dropbox.com/u/40949268/emcc/bugs/constexpr_fail.cpp which fails as
follows: https://dl.dropbox.com/u/40949268/emcc/bugs/constexpr_fail.txt
The same problem is tracked in the emscripten issue tracker here:
https://github.com/kripken/emscripten/issues/1019
I also tried with the Clang trunk on Windows, which also fails in the same way:
https://dl.dropbox.com/u/40949268/emcc/bugs/constexpr_fail_clang33trunk.txt
Any ideas what could cause this kind of thing to work on linux and OSX builds
of Clang, but not on Windows builds of Clang?
--
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/20130402/e59557c0/attachment.html>
More information about the llvm-bugs
mailing list