[Bug c++/51884] [C++11] ICE with local class/lambda template argument

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 6 14:09:00 GMT 2013


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
            Summary|lambda with templates       |[C++11] ICE with local
                   |                            |class/lambda template
                   |                            |argument

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-06 14:09:01 UTC ---
And reduced again, as much as possible.  The ICE is caused by trying to
generate the partially-instantiated type of foo<int>::bar, and thereby looking
up test<int>::value, which uses the (non-reentrant) dfs functions, in order to
mangle the name of B<C>'s vtable, which is also done using the dfs functions.

template<typename>
  struct test { static const int value = 0; };
template<int>
  struct enable_if { typedef void type; };

struct A { virtual void f() {} };
template<typename> struct B : A { };

template<typename, typename = void> struct foo;
template<typename T>
struct foo<T,typename enable_if<test<T>::value>::type>
{
  template <bool> void bar() const  {
    struct C { } c;
    B<C> b;
  }
};

int main() {
  foo<int> f;
  f.bar<true>();
}



More information about the Gcc-bugs mailing list