>> I'm not sure I follow how this comment relates to the patch.<div><br></div><div>I see that a CXXRecordDecl is created during template instantiation via RequireCompleteType(). The abort is triggered by dyn_cast to a CXXRecordDecl before it has been created. I am not sure if the Right thing to do is instantiate the template here, thus creating the CXXRecordDecl, instead of just returning if the declarator is dependently typed. Sorry if this doubt doesn't make sense.. I am still very new to the code base and the world of compiling.<br>
<br>I have attached an updated patch. Thanks for the feedback!</div><div><br></div><div>Brian<br><br><div class="gmail_quote">On Thu, Nov 1, 2012 at 6:52 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Nov 1, 2012 at 5:36 AM, Brian Brooks <<a href="mailto:brooks.brian@gmail.com">brooks.brian@gmail.com</a>> wrote:<br>
> Adding cfe-dev...<br>
<br>
Dropping cfe-dev via bcc, you were right first time.<br>
<div class="im"><br>
> On Wed, Oct 31, 2012 at 5:26 PM, Brian Brooks <<a href="mailto:brooks.brian@gmail.com">brooks.brian@gmail.com</a>><br>
> wrote:<br>
>> The attached patch needs review please!<br>
>><br>
>> I suspect that we may need to call RequireCompleteType() to do<br>
>> instantiation *even if* the VDecl is a dependent type. I am not yet able to<br>
>> reason about this though.<br>
<br>
</div>I'm not sure I follow how this comment relates to the patch.<br>
<div class="im"><br>
>> The patch prevents the abort, and the test case (extended with code to<br>
>> print initialized data) output looks the same in clang and gcc.<br>
<br>
</div>- QualType baseType = Context.getBaseElementType(var->getType());<br>
- if (baseType->isDependentType()) return;<br>
+ QualType type = var->getType();<br>
+ QualType baseType = Context.getBaseElementType(type);<br>
+ if (type->isDependentType() || baseType->isDependentType())<br>
+ return;<br>
<br>
You only need to check 'type' here. It will be dependent whenever 'baseType' is.<br>
<br>
--- test/SemaCXX/PR13788.cpp (revision 0)<br>
+++ test/SemaCXX/PR13788.cpp (revision 0)<br>
<br>
We prefer to add tests to existing test files when that is reasonable.<br>
test/SemaTemplate/dependent-sized_array.cpp seems like a good place<br>
for this test (please add a comment pointing at PR13788 to the test<br>
case, or put it in namespace PR13788, or similar).<br>
<br>
Thanks!<br>
</blockquote></div><br></div>