[cfe-dev] parse bug?

Howard Hinnant hhinnant at apple.com
Fri Jul 13 10:04:29 PDT 2012


On Jul 13, 2012, at 12:56 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Fri, Jul 13, 2012 at 9:44 AM, Howard Hinnant <hhinnant at apple.com> wrote:
>> #include <type_traits>
>> 
>> template <typename, typename = std::true_type>
>> struct is_comparable : public std::false_type {
>> };
>> 
>> template <typename T>
>> struct is_comparable<T,
>>  typename std::is_convertible<
>>    decltype(T() > T()), bool
>>> ::type> : public std::true_type {
>> };
>> 
>> clang++ -stdlib=libc++ -std=c++11 test.cpp
>> test.cpp:10:18: error: expected ')'
>>    decltype(T() > T()), bool
>>                 ^
>> test.cpp:10:13: note: to match this '('
>>    decltype(T() > T()), bool
>>            ^
>> 1 error generated.
>> 
>> Should the compiler be able to interpret the '>' as a greater-than instead of a close-template-brace since we're inside of parentheses?
> 
> This looks like
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058564.html

Agreed, thanks.  I should've checked tip-of-trunk first.

Howard




More information about the cfe-dev mailing list