<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - numeric_limits::max() bug with delayed template parsing [limits]"
href="http://llvm.org/bugs/show_bug.cgi?id=17661">17661</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>numeric_limits::max() bug with delayed template parsing [limits]
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ehomyakov@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>numeric_limits<>::max() does not instantiate in this and only this particular
combination:
* Xcode 5.0
* -std=c++11
* -stdlib=libc++
* -fdelayed-template-parsing
The bug disappears if I drop any of these (e.g. use Xcode 4.6.3, or drop either
or all of the flags).
$ cat test.cpp
#include <limits>
template<class T> void bug() { (std::numeric_limits<int>::max)(); }
int main() { bug<int>(); }
$ clang++ -std=c++11 -stdlib=libc++ -fdelayed-template-parsing -c -o test.o
test.cpp
In file included from test.cpp:1:
/usr/bin/../lib/c++/v1/limits:443:85: error: unexpected type name '__base':
expected expression
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT
{return __base::max();}
^
/usr/bin/../lib/c++/v1/limits:443:61: error: no return statement in constexpr
function
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT
{return __base::max();}
^
2 errors generated.
$ clang++ --version
Apple LLVM version 5.0 (clang-500.1.74) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
$ xcodebuild -version
Xcode 5.0
Build version 5A1413
Note: the error message will differ if I drop parentheses around max. I will
include the alternative one here so that people could google it too:
In file included from test.cpp:1:
/usr/bin/../lib/c++/v1/limits:443:91: error: expected '(' for function-style
cast or type construction
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT
{return __base::max();}
~~~~~~^</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>