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 18031 - Assertion failed: (CurFn->isDeclaration() && "Function already has body?"), function StartFunction, file CodeGenFunction.cpp, line 500.
Summary: Assertion failed: (CurFn->isDeclaration() && "Function already has body?"), f...
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: LLVM Codegen (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-22 08:27 PST by David Kilzer
Modified: 2013-11-23 12:45 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer 2013-11-22 08:27:56 PST
Reduced test case:

typedef struct mystruct { } *mystruct_t;
class MyClass {
 static const MyClass* create(mystruct_t q);
};
const MyClass* MyClass::create(mystruct_t q) { return 0; }
extern "C" {
 const MyClass* _ZN7MyClass6createEP8mystruct(mystruct_t q) { return 0; }
}

Original arguments used to reproduce (on Mac OS X 10.9) with trunk clang r194422:

./clang-r194422/bin/clang -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -disable-free -main-file-name x.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 142 -gdwarf-2 -stdlib=libc++ -Os -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -Wno-c++11-extensions -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Wmost -Wpointer-arith -Wcast-align -Wno-error=deprecated-declarations -fdeprecated-macro -ferror-limit 19 -fmacro-backtrace-limit 0 -fmessage-length 0 -fvisibility-inlines-hidden -stack-protector 1 -mstackrealign -fblocks -fno-rtti -fno-threadsafe-statics -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fobjc-gc -fobjc-exceptions -fexceptions -fpascal-strings -fno-common -fdiagnostics-show-option -fdiagnostics-show-note-include-stack -fasm-blocks -vectorize-loops -vectorize-slp -x c++ x.cpp
Comment 1 Argyrios Kyrtzidis 2013-11-22 12:23:56 PST
Also filed as rdar://15522601.
Comment 2 Argyrios Kyrtzidis 2013-11-23 12:45:19 PST
With r195556 clang emits an error.