Bug 53139 - internal compiler error: expected a type, got '#'tree_vec' not supported by dump_expr#<expression error>'
Summary: internal compiler error: expected a type, got '#'tree_vec' not supported by d...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-27 10:10 UTC by niXman
Modified: 2012-04-27 11:23 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-04-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description niXman 2012-04-27 10:10:35 UTC
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
Comment 1 Marc Glisse 2012-04-27 10:26:35 UTC
Works fine on trunk (since very recently). The 4.6 message looks fine (it indeed wasn't implemented in 4.6). Can you check whether it works with a 4.7 snapshot?
Comment 2 Richard Biener 2012-04-27 10:40:10 UTC
Confirmed on the 4.7 branch.
Comment 3 niXman 2012-04-27 11:08:17 UTC
with 4.7-branch rev-186846 and trunk rev-186841 - everything is ok.
Comment 4 Richard Biener 2012-04-27 11:23:00 UTC
Indeed.