Bug 44994

Summary: [C++0x] ICE on invalid with variadic templates
Product: gcc Reporter: Paolo Carlini <paolo.carlini>
Component: c++Assignee: Jason Merrill <jason>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, jason, redi
Priority: P3 Keywords: ice-on-invalid-code
Version: 4.6.0   
Target Milestone: 4.6.1   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2011-05-25 20:42:04

Description Paolo Carlini 2010-07-19 18:27:02 UTC
The below ICEs with:

a.cc:11:32: error: expected nested-name-specifier before ‘.’ token
a.cc:11:32: error: expected ‘>’ before ‘.’ token
a.cc: In instantiation of ‘const bool mini_is_constructible<int, A, A>::value’:
a.cc:20:44:   instantiated from here
a.cc:15:63: error: no matching function for call to ‘mini_is_constructible<int, A, A>::test(int)’

Internal compiler error: Error reporting routines re-entered.

////////////////

template<typename Tp, typename... Args>
  class mini_is_constructible
  {
    typedef char one;
    typedef struct { char arr[2]; } two;

    template<typename Tp1, typename... Args1>
      static decltype(Tp1(Args1()...), one())
      test(int);

    template<typename, typename..> // Note missing dot.
      static two test(...);

  public:
    static const bool value = sizeof(test<Tp, Args...>(0)) == 1;
  };

class A { };

int Test[mini_is_constructible<int, A, A>::value ? -1 : 1];
Comment 1 Jason Merrill 2011-05-25 20:41:24 UTC
*** Bug 49156 has been marked as a duplicate of this bug. ***
Comment 2 Jason Merrill 2011-05-26 03:07:05 UTC
Fixed for 4.6.1.