<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - "Broken nested name specifier"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=47842">47842</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"Broken nested name specifier"' failed
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>tangyixuan@mail.dlut.edu.cn
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi, the following code is ill-formed. Besides error diagnostics, clang also
crashes. However, I suffer two questions:
1. If the user-defined name 'NamespaceDeclA' is replaced with other name, such
as a simple name 'A', clang would not crash.
2. Following the suggestions of the error diagnostics, the error in code would
not be fixed while other error diagnostics would appear.

$ cat s.cpp
namespace NamespaceDeclA { 
  struct S {} S ;

struct NamespaceDeclA :: S :: NamespaceDeclB :: S {};

$ clang++ -c s.cpp

s.cpp:4:8: error: no member named 'NamespaceDeclB' in 'NamespaceDeclA::S'; did
you mean 'NamespaceDeclA'?
struct NamespaceDeclA :: S :: NamespaceDeclB :: S {};
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       NamespaceDeclA
s.cpp:1:11: note: 'NamespaceDeclA' declared here
namespace NamespaceDeclA { 
          ^
clang++:
/home/oscar/compiler/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp:79:
static clang::NestedNameSpecifier* clang::NestedNameSpecifier::Create(const
clang::ASTContext&, clang::NestedNameSpecifier*, const clang::NamespaceDecl*):
Assertion `(!Prefix || (Prefix->getAsType() == nullptr &&
Prefix->getAsIdentifier() == nullptr)) && "Broken nested name specifier"'
failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/local/bin/clang++ -std=c++2a -c 502-14-1.C 
1.      502-14-1.C:4:49: current parser token 'S'
 #0 0x00005641af7729e0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:0
 #1 0x00005641af772a84 PrintStackTraceSignalHandler(void*)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:627:0
 #2 0x00005641af77083b llvm::sys::RunSignalHandlers()
/home/oscar/compiler/llvm-project/llvm/lib/Support/Signals.cpp:70:0</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>