[cfe-commits] r154844 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Parse/ include/clang/Sema/ lib/Parse/ lib/Sema/ test/CXX/class/class.mem/ test/CXX/expr/expr.prim/expr.prim.general/ test/CXX/temp/temp.decls/temp.variad

Richard Smith richard at metafoo.co.uk
Fri Apr 20 13:25:14 PDT 2012


This change causes a regression in C++11 mode:

struct A {
  virtual ~A();

  struct Inner {
    ~Inner() throw();
  };
  Inner inner;
};

We don't parse A::Inner's exception specification until after we call
ActOnFields for A and try to compute A::~A's exception specification.
Consequently, since A::~A calls Inner::~Inner, A::~A's exception
specification is computed as EST_Delayed, and never fixed. That causes a
rejects-valid for code like this:

struct B {
  virtual ~B() {}
};

struct C : B {
  virtual ~C() {}
  A a;
};

Here, we assert when checking that C's exception specification is no looser
than B's, because we can't compute C's exception spec.

On Mon, Apr 16, 2012 at 5:24 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> On Apr 16, 2012, at 12:44 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>
> On Mon, Apr 16, 2012 at 11:27 AM, Douglas Gregor <dgregor at apple.com>wrote:
>
>> Author: dgregor
>> Date: Mon Apr 16 13:27:27 2012
>> New Revision: 154844
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=154844&view=rev
>> Log:
>> Implement the last part of C++ [class.mem]p2, delaying the parsing of
>> exception specifications on member functions until after the closing
>> '}' for the containing class. This allows, for example, a member
>> function to throw an instance of its own class. Fixes PR12564 and a
>> fairly embarassing oversight in our C++98/03 support.
>>
>
> This feature was removed from the language in DR1308 (which was voted into
> the WP at Kona).
>
>
> Richard and I have discussed this, and we think that removing this feature
> from the language is in error. We'll continue to implement the pre-DR1308
> wording and bring the issue up for discussion again at the new committee
> meeting.
>
> - Doug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120420/28a5ba98/attachment.html>


More information about the cfe-commits mailing list