<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 --- - Compiler accepting ill-formed program trying to define a struct via using-declaration" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24138&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=5fSaITeU_wE4Dj-3XHaH0TkUo_OLFTn_SFz_82Ixhp8&s=qPF3_ZGORaGqLBjBUpVVicAcUHdJtUJ-gX4Sy4K8jFY&e=">24138</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiler accepting ill-formed program trying to define a struct via using-declaration
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>anders.granlund.0@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following program:

  namespace R {
      struct f;
  }

  namespace S {
      using R::f;
  }
  struct S::f {};

  int main() {}

But clang compiles it without any error messages. The expected behaviour is to
get an error message.

The program is ill-formed by the following clauses in the c++ standard:

* [class]p11 ( <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__eel.is_c-2B-2Bdraft_class-2311&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=5fSaITeU_wE4Dj-3XHaH0TkUo_OLFTn_SFz_82Ixhp8&s=JOlAyOPrk7Z76HpX-5zOyA90jGMLww7xJ7fjmo4Ei7E&e=">http://eel.is/c++draft/class#11</a> ):
Note especially the sentence "i.e., not merely inherited or introduced by a
using-declaration"

* [dcl.meaning]p1 ( <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__eel.is_c-2B-2Bdraft_dcl.meaning-231&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=5fSaITeU_wE4Dj-3XHaH0TkUo_OLFTn_SFz_82Ixhp8&s=hC3RfHkdnbH9NdiP9Mc6G-5pN_CvluRmYt2mkPKSNY8&e=">http://eel.is/c++draft/dcl.meaning#1</a> ):
Not especially the sentence "the member shall not merely have been introduced
by a using-declaration in the scope of the class or namespace nominated by the
nested-name-specifier of the declarator-id."</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>