[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c++/72752] internal compiler error: in retrieve_specialization
From:       "mikeus at hotmail dot ru" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2016-07-31 8:45:31
Message-ID: bug-72752-4-Zwo1HV4d4k () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72752

--- Comment #1 from Michael <mikeus at hotmail dot ru> ---
When it is explicitly specified to use a default template argument the code is
compiled successfully:
----- 8< ---------- 8< ---------- 8< -----
typedef void (*foo_t)();

void test(foo_t)
{}

template< typename >
struct A
{
  template< typename = void > static void foo();

  void bar()
  {
    test(foo<>);
  }

  template< typename >
  void baz()
  {
    test(foo<>);
  }
};

template< typename _T_ >
template< typename >
void A< _T_ >::foo()
{}
----- >8 ---------- >8 ---------- >8 -----

Here is a variation for one more test case:
ICE generated:
----- 8< ---------- 8< ---------- 8< -----

typedef void (*foo_t)();

void test(foo_t, foo_t)
{}

template< typename >
struct A
{
  template< typename = void > static void foo1();
  template< typename = void > static void foo2();

  void bar()
  {
    test(foo1, foo2);
  }

  template< typename >
  void baz()
  {
    test(foo1, foo2);
  }
};

template< typename _T_ >
template< typename >
void A< _T_ >::foo1()
{}

template< typename _T_ >
template< typename >
void A< _T_ >::foo2()
{}
----- >8 ---------- >8 ---------- >8 -----

Successfully passed:
----- 8< ---------- 8< ---------- 8< -----

typedef void (*foo_t)();

void test(foo_t, foo_t)
{}

template< typename >
struct A
{
  template< typename = void > static void foo1();
  template< typename = void > static void foo2();

  void bar()
  {
    test(foo1, foo2<>);
  }

  template< typename >
  void baz()
  {
    test(foo1<>, foo2);
  }
};

template< typename _T_ >
template< typename >
void A< _T_ >::foo1()
{}

template< typename _T_ >
template< typename >
void A< _T_ >::foo2()
{}
----- >8 ---------- >8 ---------- >8 -----=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic