[Bug c++/51194] ICE about template aliasing

dodji at seketeli dot org gcc-bugzilla@gcc.gnu.org
Thu Nov 17 17:37:00 GMT 2011


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

--- Comment #1 from dodji at seketeli dot org <dodji at seketeli dot org> 2011-11-17 17:33:28 UTC ---
I could not reproduce the ICE with svn trunk revision r181378.  Here is
what I get:

$ cat -n test.cc
     1    #include <boost/mpl/and.hpp>
     2    #include <boost/type_traits/is_same.hpp>
     3    
     4    template < bool, class T = void >
     5    enable_if_c
     6    {
     7        typedef T type;
     8    };
     9    template < class T >
    10    enable_if_c<false, T>
    11    { };
    12    
    13    template < class Cond, class T = void >
    14    using enable_if = enable_if_c<Cond::value, T>;
    15    
    16    template < template <class...> class... Conds >
    17    struct condition_and
    18    {
    19        template < class... Types >
    20        using enable = enable_if<boost::mpl::and_<Conds<Types>...>>;
    21    };
    22    
    23    template < class T, class U = T >
    24    using Test = typename condition_and
    25    < 
    26        // For any two parameters meta-functions, same error occurs.
    27        boost::is_same
    28        , boost::is_same
    29        , boost::is_same
    30        >::template enable<T, U>; // here
$ g++ -std=c++0x test.cc

test.cc:5:1: erreur: ‘enable_if_c’ does not name a type
test.cc:10:1: erreur: ‘enable_if_c’ does not name a type
test.cc:14:19: erreur: expected type-specifier before ‘enable_if_c’
test.cc:14:19: erreur: expected ‘;’ before ‘enable_if_c’
test.cc:14:19: erreur: ‘enable_if_c’ does not name a type
test.cc:14:19: erreur: mismatched argument pack lengths while expanding
‘Conds<Types>’
$ 

Note that the code is not valid.

If you are still getting an ICE, please provide the pre-processed output
(using the option -save-temps, for instance) so that I can be sure to
use a similar environment as the one you used.

Thanks.



More information about the Gcc-bugs mailing list