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

Nico Weber thakis at chromium.org
Wed Aug 27 10:14:21 PDT 2014


On Tue, Aug 26, 2014 at 4:24 PM, Richard Smith <richard at metafoo.co.uk>
wrote:

> Thanks, I prefer this approach.
>
> It seems strange to have the bail-out after we implicitly define special
> members but before we implicitly instantiate templates. Can the OdrUse
> check, the use-from-self check, and the ResolveExcpetionSpec call be moved
> to before we define special members? Does that break something? (I think
> this should only matter if an implicitly-defined special member is used
> from itself... which shouldn't matter.)
>

Yes, a bunch of tests (3) fail if I move the two early returns and
the ResolveExceptionSpec call above the CXXConstructorDecl if. I landed v2
of the patch in r216562.


>
> On Tue, Aug 26, 2014 at 2:18 PM, Nico Weber <thakis at chromium.org> wrote:
>
>> Ok, how does this look?
>>
>>
>> On Thu, Aug 21, 2014 at 1:28 PM, Richard Smith <richard at metafoo.co.uk>
>> wrote:
>>
>>> 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/20140827/aff8fac5/attachment.html>


More information about the cfe-commits mailing list