diff mbox

C++ Patch for c++/60894

Message ID 54DBA923.6060602@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Feb. 11, 2015, 7:10 p.m. UTC
Hi,

On 12/01/2014 09:59 PM, Jason Merrill wrote:
> On 12/01/2014 07:01 AM, Fabien ChĂȘne wrote:
>> 2014-11-03 21:18 GMT+01:00 Fabien ChĂȘne <fabien.chene@gmail.com>:
>>> 2014-10-09 15:34 GMT+02:00 Jason Merrill <jason@redhat.com>:
>>> [...]
>>>>> If the USING_DECL is returned, the code below will be rejected as
>>>>> expected, but the error message will not mention the line where the
>>>>> USING_DECL appears as the previous definition, but at the target
>>>>> declaration of the USING_DECL instead.
>>>>
>>>>
>>>> I think that's what happens if you strip the USING_DECL and return 
>>>> what it
>>>> points to; if you return the USING_DECL itself that shouldn't 
>>>> happen (though
>>>> then the caller needs to be able to deal with getting a USING_DECL).
>>>
>>> [Sorry for the delay] Humm, l_a_c_t returns a TYPE upon success, shall
>>> I change it and return a DECL instead ?
>>
>> Ping. Before I made the change, I'd like to be sure this is what you
>> have in mind.
>
> I think that makes sense.

Today I was having a look to this pending issue and went astray due to 
the broken thread: I wondered if, basing on Fabien' first try and the 
comments accompanying tag_scope, it would make sense to use 
strip_using_decl only when the scope is ts_global (or maybe != 
ts_current)?!? The below certainly passes testing. Unless of course 
Fabien has the above implemented and ready (I don't, I miss the correct 
changes to the lookup_and_check_tag callers)

Thanks,
Paolo.

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

Comments

Jason Merrill Feb. 13, 2015, 3:03 p.m. UTC | #1
On 02/11/2015 02:10 PM, Paolo Carlini wrote:
> Today I was having a look to this pending issue and went astray due to
> the broken thread: I wondered if, basing on Fabien' first try and the
> comments accompanying tag_scope, it would make sense to use
> strip_using_decl only when the scope is ts_global (or maybe !=
> ts_current)?!?

Good thought, that makes sense and is a lot simpler.  But I think since 
we have a ts_global block earlier in the function, let's do the 
stripping there, right after the call to lookup_name_prefer_type.  OK 
with that change.

Jason
diff mbox

Patch

Index: decl.c
===================================================================
--- decl.c	(revision 220611)
+++ decl.c	(working copy)
@@ -12207,6 +12207,9 @@  lookup_and_check_tag (enum tag_types tag_code, tre
 	      && DECL_TEMPLATE_TEMPLATE_PARM_P (decl))))
     decl = DECL_TEMPLATE_RESULT (decl);
 
+  if (scope == ts_global)
+    decl = strip_using_decl (decl);
+
   if (decl && TREE_CODE (decl) == TYPE_DECL)
     {
       /* Look for invalid nested type: