<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 --- - [CWG 734] Nonconforming aliasing of block scope objects"
   href="https://llvm.org/bugs/show_bug.cgi?id=27443">27443</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[CWG 734] Nonconforming aliasing of block scope objects
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>frankhb1989@gmail.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>Case:

// clang++ -std=c++14 -O0 -pedantic-errors
#include <cstdlib>

void foo(const int* p = {})
{
    const int a[] = {1, 2, 3, 4};
    if(p == a)
        std::abort();
    if(!p)
        foo(a);
}

int main()
{
    foo();
}

As per [intro.object]/5, 'std::abort' should not be called. The rule is
introduced by resolution of CWG 734 and applicable here, though the title of
that issue is about "namespace-scope variables".

However, The program compiled by clang++ with will abort while g++ works well.

The C compilers have similar issues. Not sure for the requirements from ISO C.

Related discussion: <a href="https://gcc.gnu.org/ml/gcc/2016-04/msg00178.html">https://gcc.gnu.org/ml/gcc/2016-04/msg00178.html</a></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>