[llvm-bugs] [Bug 36429] New: clang allows creation of objects of abstract class type

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 18 21:30:42 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36429

            Bug ID: 36429
           Summary: clang allows creation of objects of abstract class
                    type
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Testcase:

struct Abs { virtual void f() = 0; };
struct C { C(Abs) {} };
struct Q { operator Abs() { __builtin_unreachable(); } };
C c = Q().operator Abs();

At least the second and third lines of this should report an error -- defining
functions that take and return an abstract class type. The fourth line should
likely generate an error too, as it creates an object of abstract class type.

Only the fourth line generates an error, and even that error disappears in
C++17 mode (as no temporary is created, just a parameter object).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180219/aad3e0c6/attachment.html>


More information about the llvm-bugs mailing list