[cfe-dev] Clang template parse problem?

Thiago Adams thiago.adams at gmail.com
Wed Jun 6 07:45:58 PDT 2012

I am having problems to compile this program using clang
and it seems a parser bug.

clang version 3.2 (trunk)
Target: i686-pc-win32
Thread model: posix

(Thanks Mello for providing a updated build for windows.)

Simplified code:

#include <type_traits>

struct Property {};
struct Property2 : public Property {};

template<class T>
struct is_property : public std::is_base_of<Property, T> {};

template <class TA, class TB>
auto operator > (const TA& a, const TB& b)
-> typename std::enable_if < is_property<TA>::value ||
            decltype(eval(a) > eval(b)) >::type
    return true;

int main()
    Property2 a;
    Property2 b;
    if (a > b)
      return 1;
    return 0;


error: expected ')'
decltype(eval(a) > eval(b)) >::type

^ points to ">"


Is it a bug?
I am new to clang. Where do I report this problem?

The workaround is to change:

decltype(eval(a) > eval(b))

Full code is :

More information about the cfe-dev mailing list