[Bug c++/6709] [DR743] decltype cannot be used with the :: operator

osa252 at mail dot ru gcc-bugzilla@gcc.gnu.org
Wed Apr 6 14:24:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709

cheburnae <osa252 at mail dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |osa252 at mail dot ru

--- Comment #18 from cheburnae <osa252 at mail dot ru> 2011-04-06 14:23:53 UTC ---
A simple workaround:

template <class T>
struct TypeEcho {
    typedef T R;
};

#define TYPE_OF(expr) TypeEcho<typeof (*&expr)>::R

template <class T>
void foo() {
    typename TYPE_OF(std::vector<T>())::value_type();
}

void foo2() {
    TYPE_OF(std::vector<int>())::value_type();
    foo<int>();
}



More information about the Gcc-bugs mailing list