LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 21837 - [fuzz] Assertion `Access == AS_private || Access == AS_protected' failed.
Summary: [fuzz] Assertion `Access == AS_private || Access == AS_protected' failed.
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
: 22055 (view as bug list)
Depends on:
Blocks: 23057
  Show dependency tree
 
Reported: 2014-12-10 15:28 PST by Sami Liedes
Modified: 2019-02-21 14:10 PST (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments
test case (32 bytes, text/x-c++src)
2014-12-10 15:28 PST, Sami Liedes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sami Liedes 2014-12-10 15:28:23 PST
Created attachment 13478 [details]
test case

Fuzzing discovered that the attached test case, when given as input to

  clang -fno-crash-diagnostics -std=c++11 -xc++ -c -emit-llvm

causes this assertion failure:

clang-3.6: tools/clang/lib/Sema/SemaAccess.cpp:737: 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.
Comment 1 David Majnemer 2014-12-17 02:56:48 PST
reasonable test case:
struct B {
  template <struct U : U { } > void f();
};
Comment 2 Nico Weber 2014-12-29 18:43:38 PST
*** Bug 22055 has been marked as a duplicate of this bug. ***
Comment 3 Nico Weber 2014-12-29 18:44:15 PST
Slightly different test case:

struct A {
  template <class B {}, B> void f() {}
};
Comment 4 Reid Kleckner 2015-12-11 14:40:19 PST
Another one:

template <typename T> struct U;
struct A {
  enum { X = U<struct B{}>::val, Y = sizeof(B) };
};

All of these test cases define a struct that gets an access specifier of AS_none, but the struct ends up hanging out in a RecordDecl, confusing access control.
Comment 5 Reid Kleckner 2019-02-21 14:10:33 PST
None of these examples crash anymore.