This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 34272, v2 + PR 42062


On 02/23/2010 07:51 PM, Jason Merrill wrote:
> On 12/03/2009 07:29 AM, Paolo Carlini wrote:
>> - gcc_assert (TMPL_ARGS_DEPTH (args)
>> + if (TMPL_ARGS_DEPTH (args)
>> + return error_mark_node;
> I'm uncomfortable about returning error_mark_node without giving an
> error. Why can't we return error_mark_node at the point where we give
> an error?
I understand your point. If I remember correctly - it's been a while -
there is a problem with diagnostic quality, in the sense that if I
simply do this:

Index: pt.c
--- pt.c (revision 157019)
+++ pt.c (working copy)
@@ -3874,6 +3874,9 @@ process_partial_specialization (tree decl)
error (" %qD", TREE_VALUE (TREE_VEC_ELT (inner_parms, i)));

+ if (did_error_intro)
+ return error_mark_node;
/* [temp.class.spec]

The argument list of the specialization shall not be identical to

then for a testcase like pr31439.C:

// { dg-options "-std=c++0x" }
template<typename...> struct A;

template<char> struct A<> {}; // { dg-error "not used in partial
specialization|anonymous" }

template<typename T, typename... U> struct A<T, U...> : A<U...> {};

A<int> a;

we end up emitting *additional* diagnostics triggered by 'a':

pr31439.C:4:23: error: template parameters not used in partial
pr31439.C:4:23: error: ‘<anonymous>’
pr31439.C: In instantiation of ‘A<int>’:
pr31439.C:8:8: instantiated from here
pr31439.C:6:65: error: invalid use of incomplete type ‘struct A<>’
pr31439.C:2:30: error: declaration of ‘struct A<>’

Thus, I'm going to spend some more time on this unwanted side effect: a
little bit of guidance would be welcome, of course ;)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]