[cfe-dev] parse bug?

Dmitri Gribenko gribozavr at gmail.com
Fri Jul 13 09:56:51 PDT 2012


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

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list