[LLVMbugs] [Bug 17661] New: numeric_limits::max() bug with delayed template parsing [limits]

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 23 04:01:14 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17661

            Bug ID: 17661
           Summary: numeric_limits::max() bug with delayed template
                    parsing [limits]
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: ehomyakov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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();}
                                                                               
    ~~~~~~^

-- 
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/20131023/c08f619a/attachment.html>


More information about the llvm-bugs mailing list