[patch] Don't assert when calling a pure method with exception spec of a template class

Richard Smith richard at metafoo.co.uk
Thu Aug 21 13:28:41 PDT 2014


I'm a bit uncomfortable about duplicating a fragment of
MarkFunctionReferenced here. Various other parts of MarkFunctionReferenced
logically belong here too, but the problematic cases can't happen only
because virtual functions can't be constexpr, nor can they have deduced
return types.

I wonder whether we should instead be passing the OdrUse flag into
MarkFunctionReferenced and having it skip the things that don't happen for
a reference that's not an odr-use.


On Wed, Aug 20, 2014 at 8:08 PM, Nico Weber <thakis at chromium.org> wrote:

> Ping :-)
>
>
> On Sat, Aug 16, 2014 at 10:24 PM, Nico Weber <thakis at chromium.org> wrote:
>
>> Hi,
>>
>> clang  currently asserts on the following program when building with
>> -std=c++11 (PR19190):
>>
>>   template <class T> struct DWFIterator { virtual T &get() throw(int) =
>> 0; };
>>   void foo(DWFIterator<int> *foo) { foo->get(); }
>>
>> This is because in C++11, instantiation of exception specs is deferred.
>> This usually happens in MarkFunctionReferenced(), but that's never called
>> for pure functions. So the exception spec stays unresolved, and codegen
>> then complains about that. (See the bug for details.)
>>
>> The attached patch lets Sema::MarkAnyDeclReferenced()
>> call ResolveExceptionSpec() for non-OdrUse functions. This fixes the assert
>> and passes all tests, but I'm not sure if it's the best place to do this –
>> hence, pre-commit review, please :-)
>>
>> Nico
>>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140821/eb752328/attachment.html>


More information about the cfe-commits mailing list