[C++ Patch/RFC] PR 71569 ("[6/7/8 regression] Crash: External definition of template member from template struct")

Jason Merrill jason@redhat.com
Wed Feb 28 19:20:00 GMT 2018


On Wed, Feb 28, 2018 at 1:42 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> On 28/02/2018 17:24, Jason Merrill wrote:
>>>
>>> What do you think, should we do something similar?
>>
>> Sounds good.
>>
>>> (by the way, yesterday
>>> got a bit confused because in other vaguely related cases clang also has
>>> this kind of two-part error message and we don't. Eg, I cooked up:
>>>
>>> template <class T>
>>> class Foo
>>> {
>>>    template <class U>
>>>    class Bar;
>>> };
>>>
>>> template<class T>
>>> template<class U>
>>> class Foo<T>::Bar<U>;
>>
>> And the same would be good for this example.
>
> Great. I'm finishing testing the below, looks Ok?

Hmm, the test seems wrong; the diagnostic talks about specializing the
arguments, but the actual test is checking whether the enclosing scope
is fully specialized.  It looks like you'll give the same error for

template <class T>
struct A {
  template <class U>
  static const U u;
};

template <class T>
template <class U>
const U* A<T>::u<U*> = nullptr;

which does specialize the argument; since we accept

template <class T>
struct A {
  template <class U>
  struct B;
};

template <class T>
template <class U>
struct A<T>::B<U*> { };

we ought to accept the above as well.

So, we could reject the testcase with this error, but we would need to
test for it using the same check as in process_partial_specialization.

Jason



More information about the Gcc-patches mailing list