parse bug?

#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?

There's a report on comp.lang.c++.moderated that GCC 4.6.3 parses this.

Howard

This looks like
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058564.html

Dmitri

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

Howard