[cfe-dev] Bug? This code should be clearly rejected!

Wilhelm wilhelm.meier at fh-kl.de
Sun Mar 29 03:41:22 PDT 2015


Am 27.03.2015 um 17:15 schrieb David Blaikie:
> 
> 
> On Fri, Mar 27, 2015 at 3:26 AM, Wilhelm <wilhelm.meier at fh-kl.de
> <mailto:wilhelm.meier at fh-kl.de>> wrote:
> 
>     Hi all,
> 
>     why does this wrong code compile with clang++ 3.6 (g++ rejects it
>     correctly)?
> 
> 
> Yep. Looks like a bug to me. I think we had the same bug for return
> types of abstract classes too & that was fixed a few months ago. Seems
> we haven't fully flushed out these issues... 

Is this already filed as bug? Or fixed in upstream version?

>  
> 
> 
>     class Abc
>     {
>     public:
>         virtual void foo() const = 0;
>         virtual ~Abc() {}
>     };
>     class Impl : public Abc {
>     public:
>         void foo() const {}
>     };
>     class B
>     {
>     public:
>         void bar(Abc o)
>         {
>             o.foo();
>         }
>     };
>     int main()
>     {
>         B b;
>         Impl i;
>         b.bar(i);
>     }
> 
>     --
>     Wilhelm
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 


-- 
Wilhelm



More information about the cfe-dev mailing list