[PATCH] Fix for PR18393 - emit error when abstract type is returned or taken by value

Richard Smith richard at metafoo.co.uk
Thu Sep 25 17:08:52 PDT 2014


Clang doesn't do this immediately because that's not correct:

  struct S {
    S f();
    virtual void g() = 0;
  };

We can't tell that we need to diagnose `f` until we reach the declaration
of `g`.

On Fri, Sep 19, 2014 at 5:04 AM, Robert Matusewicz <matekm at gmail.com> wrote:

> Hi rsmith,
>
> Hi,
>
> Attached patch contains the implementation of a fix for PR18393[1].
> According to standard "An abstract class shall not be used as a parameter
> type, as a function return type, or as the type of an explicit conversion"
> (class.abstract $10.4.3).
>
> Currently, checking if type isn't abstract class is done when method is
> defined, but I don't see any reason why clang shouldn't do it as early as
> possible, in this case, when function/method is declared. Test also
> attached.
>
> Please, review and provide feedback or propose additional tests.
>
> Thanks in advance
> Robert Matusewicz
>
> http://reviews.llvm.org/D5409
>
> Files:
>   lib/Sema/SemaDecl.cpp
>   test/SemaCXX/abstract.cpp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140925/5a94d1fc/attachment.html>


More information about the cfe-commits mailing list