<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - creating object of abstract class allowed in all versions of clang++"
   href="https://llvm.org/bugs/show_bug.cgi?id=27637">27637</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>creating object of abstract class allowed in all versions of clang++
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pravasimeet999@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16308" name="attach_16308" title="bug in clang++">attachment 16308</a> <a href="attachment.cgi?id=16308&action=edit" title="bug in clang++">[details]</a></span>
bug in clang++

clang++ compiles ill formed C++ program successfully.

The following program is ill formed C++ program because it is not allowed to
create objects of abstract class. But in all versions of g++ the program
compiles successfully.

This question originally asked on stackoverflow by user Matt. See here:
<a href="http://stackoverflow.com/questions/37017094/why-do-gcc-and-clang-allow-me-to-construct-an-abstract-class">http://stackoverflow.com/questions/37017094/why-do-gcc-and-clang-allow-me-to-construct-an-abstract-class</a>
.

(See live demo here: <a href="http://melpon.org/wandbox/permlink/uT43g5lw26HWAbog">http://melpon.org/wandbox/permlink/uT43g5lw26HWAbog</a> )

#include <stdio.h>

class A
{
public:
    A() {
        printf("A()\n");
    }
    virtual void b() const = 0;
};

int main()
{
    const A& a{};
    a.b();
    return 0;
}

The program is clearly invalid &  implementation is required to produce a
diagnosis for this according to C++ standard.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>