[LLVMbugs] [Bug 9107] New: addressof(enum) assertion failure

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jan 29 16:11:34 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9107

           Summary: addressof(enum) assertion failure
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: marc.glisse at normalesup.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


enum E {};
template <class _Tp> inline _Tp* addressof(_Tp& __x) {
    return (_Tp*)&(char&)__x;
}
void test ()   {
    E a;
    addressof(a);
}

$ clang++ -std=c++0x -c a.cc
clang: /data/repos/llvm/tools/clang/lib/Sema/SemaCXXCast.cpp:612: TryCastResult
TryStaticCast(clang::Sema&, clang::Expr*&, clang::QualType, bool, const
clang::SourceRange&, unsigned int&, clang::CastKind&, clang::CXXCastPath&):
Assertion `SrcType->getAs<EnumType>()->getDecl()->isScoped()' failed.
0  clang           0x000000000177ebcf
1  clang           0x0000000001780e32
2  libpthread.so.0 0x00007f886d8b0f60
3  libc.so.6       0x00007f886cbc3165 gsignal + 53
4  libc.so.6       0x00007f886cbc5f70 abort + 384
5  libc.so.6       0x00007f886cbbc2b1 __assert_fail + 241
6  clang           0x0000000000914943
7  clang           0x0000000000914bf8
clang::Sema::CXXCheckCStyleCast(clang::SourceRange, clang::QualType,
clang::ExprValueKind&, clang::Expr*&, clang::CastKind&,
llvm::SmallVector<clang::CXXBaseSpecifier*, 4u>&, bool) + 680
8  clang           0x00000000009f6109
clang::Sema::CheckCastTypes(clang::SourceRange, clang::QualType, clang::Expr*&,
clang::CastKind&, clang::ExprValueKind&,
llvm::SmallVector<clang::CXXBaseSpecifier*, 4u>&, bool) + 329
9  clang           0x00000000009f687d
clang::Sema::BuildCStyleCastExpr(clang::SourceLocation, clang::TypeSourceInfo*,
clang::SourceLocation, clang::Expr*) + 157
10 clang           0x0000000000ae5e93
11 clang           0x0000000000ad450d
12 clang           0x0000000000ae9613
13 clang           0x0000000000ad3c3d
14 clang           0x0000000000ae5e6d
15 clang           0x0000000000ad450d
16 clang           0x0000000000ae05b8
17 clang           0x0000000000ae11d4
18 clang           0x0000000000ae0860
19 clang           0x0000000000ae1b4d clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 45
20 clang           0x0000000000af63f1
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 1073
21 clang           0x0000000000af693d
clang::Sema::PerformPendingInstantiations(bool) + 365
22 clang           0x00000000008ffe22 clang::Sema::ActOnEndOfTranslationUnit()
+ 306
23 clang           0x00000000008c40f8
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 200
24 clang           0x00000000008ab153 clang::ParseAST(clang::Sema&, bool) + 147
25 clang           0x000000000078a4e4 clang::CodeGenAction::ExecuteAction() +
68
26 clang           0x000000000067a405
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 357
27 clang           0x0000000000657fbc
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1276
28 clang           0x000000000064f915 cc1_main(char const**, char const**, char
const*, void*) + 677
29 clang           0x0000000000656fc5 main + 4549
30 libc.so.6       0x00007f886cbafc4d __libc_start_main + 253
31 clang           0x000000000064df79
Stack dump:
0.      Program arguments: /tmp/clang/inst/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
a.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.20.1 -resource-dir /tmp/clang/inst/bin/../lib/clang/2.9 -std=c++0x
-ferror-limit 19 -fmessage-length 0 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -o a.o -x c++ a.cc 
1.      <eof> parser at end of file
2.      a.cc:2:34: instantiating function definition 'addressof'

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list