<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 - Clang crash in clang/lib/Sema/SemaAccess.cpp:736 Assertion `Access == AS_private || Access == AS_protected' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=46549">46549</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang crash in clang/lib/Sema/SemaAccess.cpp:736 Assertion `Access == AS_private || Access == AS_protected' 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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>haoxintu@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi, there.

This case, bug.cc, is invalid code, clang-trunk can not emit any error messages
in it and even bug.cc makes clang crashed.

$cat bug.cc
class { int a = ( struct b : b );};


$clang++ bug.cc
clang-11:
/home/haoxin/compilers/llvm-project/clang/lib/Sema/SemaAccess.cpp:736:
AccessResult HasAccess(clang::Sema &, const (anonymous
namespace)::EffectiveContext &, const clang::CXXRecordDecl *,
clang::AccessSpecifier, const (anonymous namespace)::AccessTarget &): Assertion
`Access == AS_private || Access == AS_protected' 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:
/home/haoxin/compilers/llvm-project/build/bin/clang-11 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
bug.cc -mrelocation-model static -mframe-pointer=all -fmath-errno
-fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64
-dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/home/haoxin/compilers/llvm-project/build/lib/clang/11.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward
-internal-isystem /usr/local/include -internal-isystem
/home/haoxin/compilers/llvm-project/build/lib/clang/11.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir
/home/haoxin/bitbucket/scg-backup-bitbucket/ice-test/100000-3/creduce
-ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions
-fcolor-diagnostics -faddrsig -o /tmp/bug-a6449e.o -x c++ bug.cc 
1.      bug.cc:1:32: current parser token ')'
2.      bug.cc:1:1: parsing struct/union/class body '(anonymous)'
3.      bug.cc:1:19: parsing struct/union/class body '(anonymous class)::b'
 #0 0x00000000026f36c4 PrintStackTraceSignalHandler(void*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x26f36c4)
 #1 0x00000000026f12be llvm::sys::RunSignalHandlers()
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x26f12be)
 #2 0x00000000026f39e5 SignalHandler(int)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x26f39e5)
 #3 0x00007fc96bec1890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007fc96a91fe97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fc96a921801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fc96a91139a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fc96a911412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x0000000003ef5a69 HasAccess(clang::Sema&, (anonymous
namespace)::EffectiveContext const&, clang::CXXRecordDecl const*,
clang::AccessSpecifier, (anonymous namespace)::AccessTarget const&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ef5a69)
 #9 0x0000000003ef518a IsAccessible(clang::Sema&, (anonymous
namespace)::EffectiveContext const&, (anonymous namespace)::AccessTarget&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ef518a)
#10 0x0000000003ef083e CheckEffectiveAccess(clang::Sema&, (anonymous
namespace)::EffectiveContext const&, clang::SourceLocation, (anonymous
namespace)::AccessTarget&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ef083e)
#11 0x0000000003ef1c6d CheckAccess(clang::Sema&, clang::SourceLocation,
(anonymous namespace)::AccessTarget&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ef1c6d)
#12 0x0000000003ef4c0e clang::Sema::CheckLookupAccess(clang::LookupResult
const&) (/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ef4c0e)
#13 0x0000000003f0324d clang::LookupResult::~LookupResult()
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3f0324d)
#14 0x0000000003ff71bf clang::Sema::getTypeName(clang::IdentifierInfo const&,
clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec*, bool, bool,
clang::OpaquePtr<clang::QualType>, bool, bool, bool, clang::IdentifierInfo**)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ff71bf)
#15 0x0000000003e2435c
clang::Parser::ParseBaseTypeSpecifier(clang::SourceLocation&,
clang::SourceLocation&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e2435c)
#16 0x0000000003e2938e clang::Parser::ParseBaseSpecifier(clang::Decl*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e2938e)
#17 0x0000000003e28d8b clang::Parser::ParseBaseClause(clang::Decl*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e28d8b)
#18 0x0000000003e28362
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e28362)
#19 0x0000000003e26162
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e26162)
#20 0x0000000003e066d3
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e066d3)
#21 0x0000000003dfcb7b
clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&,
clang::AccessSpecifier, clang::Parser::DeclSpecContext)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dfcb7b)
#22 0x0000000003e3ef8c
clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool,
bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e3ef8c)
#23 0x0000000003e39e5f
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e39e5f)
#24 0x0000000003e349b9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e349b9)
#25 0x0000000003e2d9d9 clang::Parser::ParseCXXMemberInitializer(clang::Decl*,
bool, clang::SourceLocation&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e2d9d9)
#26 0x0000000003dfacf0
clang::Parser::ParseLexedMemberInitializer(clang::Parser::LateParsedMemberInitializer&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dfacf0)
#27 0x0000000003df930b
clang::Parser::ParseLexedMemberInitializers(clang::Parser::ParsingClass&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3df930b)
#28 0x0000000003e28722
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e28722)
#29 0x0000000003e26162
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e26162)
#30 0x0000000003e066d3
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e066d3)
#31 0x0000000003def66a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3def66a)
#32 0x0000000003def395
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3def395)
#33 0x0000000003dee1bf
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dee1bf)
#34 0x0000000003dec28d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dec28d)
#35 0x0000000003debad7
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3debad7)
#36 0x0000000003de76ee clang::ParseAST(clang::Sema&, bool, bool)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3de76ee)
#37 0x0000000002ebc3f3 clang::FrontendAction::Execute()
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x2ebc3f3)
#38 0x0000000002e539c3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x2e539c3)
#39 0x0000000002f67532
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x2f67532)
#40 0x000000000095d060 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x95d060)
#41 0x000000000095b12c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x95b12c)
#42 0x000000000095addf main
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x95addf)
#43 0x00007fc96a902b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#44 0x0000000000957eba _start
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x957eba)
clang-11: error: unable to execute command: Aborted (core dumped)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
b9306fd042ce1c11d84f05d2124dfdc65b8331fe)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/compilers/llvm-project/build/bin
clang-11: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/bug-a3f684.cpp
clang-11: note: diagnostic msg: /tmp/bug-a3f684.sh
clang-11: note: diagnostic msg: 

********************

$clang++ -v
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
b9306fd042ce1c11d84f05d2124dfdc65b8331fe)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/compilers/llvm-project/build/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>