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

             Bug #: 53139
           Summary: internal compiler error: expected a type, got
                    '#'tree_vec' not supported by dump_expr#<expression
                    error>'
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: i.nix...@gmail.com


This code:

// Compile: g++ -std=c++11 test.cpp
// Compile: clang++ -std=c++11 test.cpp

//#include <string>
//#include <iostream>

namespace my_types
{

struct nil {};

//original type
template <typename T, typename U>
struct chain
{
   typedef T first_type;
   typedef U second_type;
};

}

template <template <typename, typename> class Chain, typename Nil>
struct chain_generator
{
   template <typename T, typename... Args>
   struct gen
   {
   private:
      template <std::size_t S = sizeof...(Args), typename Dummy = void>
      struct inner
      {
         typedef Chain<T, typename gen<Args...>::type > type;
      };

      template <typename Dummy>
      struct inner<0, Dummy>
      {
         typedef Chain<T, Nil> type;
      };
   public:
      typedef typename inner<sizeof...(Args)>::type type;
   };
};

int main( /* int argc, char* argv[] */ )
{
   using my_types::chain;
   using my_types::nil;

   typedef chain<int, chain<float, chain<char, nil>>> t0;
   typedef chain_generator<chain, nil> my_gen;
   typedef my_gen::gen<int, float, char>::type t1;

   return 0;
}


when compiling with gcc-4.7.0 produce this errors:
> source.cpp:29:22: error: 'size_t' has not been declared
> source.cpp: In instantiation of 'struct chain_generator<my_types::chain, 
> my_types::nil>::gen<int, float, char>::inner<2, void>':
> source.cpp:41:53:   required from 'struct chain_generator<my_types::chain, 
> my_types::nil>::gen<int, float, char>'
> source.cpp:52:41:   required from here
> source.cpp:32:57: error: type/value mismatch at argument 1 in template 
> parameter list for 'template<template<class, class> class Chain, class Nil> 
> template<class T, class ... Args> struct chain_generator<Chain, Nil>::gen'
> source.cpp:32:57: error:   expected a type, got '#'tree_vec' not supported by 
> dump_expr#<expression error>'
> source.cpp:32:57: error: type/value mismatch at argument 2 in template 
> parameter list for 'template<template<class, class> class Chain, class Nil> 
> template<class T, class ... Args> struct chain_generator<Chain, Nil>::gen'
> source.cpp:32:57: error:   expected a type, got '#'tree_vec' not supported by 
> dump_expr#<expression error>'

when compiling with gcc-4.6.3 produce this errors:
> source.cpp:30:13: error: 'size_t' has not been declared
> source.cpp:33:41: sorry, unimplemented: cannot expand 'Args ...' into a 
> fixed-length argument list
> source.cpp:33:49: error: template argument 2 is invalid
> source.cpp:33:51: error: expected '::' before 'type'

with clang this code compiled successfully.

gcc-4.7.0 test-drive:
http://liveworkspace.org/code/6287f6a38362af545712f43a56851a0b

Reply via email to