<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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-cl regression: Assertion failure: "Function already has body?""
   href="http://llvm.org/bugs/show_bug.cgi?id=21718">21718</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl regression: Assertion failure: "Function already has body?"
          </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>All
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ehsan@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>class A {
public:
  A(bool);
};
template <class Base> class __declspec(dllexport) SecurityWrapper : A {
  constexpr SecurityWrapper() : Base(true) {}
};

template class SecurityWrapper<A>;

$ ./bin/clang-cl -m32 test.cpp
Assertion failed: (CurFn->isDeclaration() && "Function already has body?"),
function StartFunction, file
/Users/ehsan/src/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp, line 580.
0  clang-3.5                0x000000010bfc3d2e
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  clang-3.5                0x000000010bfc50db
PrintStackTraceSignalHandler(void*) + 27
2  clang-3.5                0x000000010bfc5525 SignalHandler(int) + 565
3  libsystem_platform.dylib 0x00007fff8f56cf1a _sigtramp + 26
4  libsystem_platform.dylib 0x0000000000000002 _sigtramp + 1890136322
5  clang-3.5                0x000000010bfc510b raise + 27
6  clang-3.5                0x000000010bfc51c2 abort + 18
7  clang-3.5                0x000000010bfc51a1 __assert_rtn + 129
8  clang-3.5                0x000000010c9ec6e7
clang::CodeGen::CodeGenFunction::StartFunction(clang::GlobalDecl,
clang::QualType, llvm::Function*, clang::CodeGen::CGFunctionInfo const&,
clang::CodeGen::FunctionArgList const&, clang::SourceLocation,
clang::SourceLocation) + 487
9  clang-3.5                0x000000010c9ee80c
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1164
10 clang-3.5                0x000000010c83244d
clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::CXXMethodDecl const*,
clang::CodeGen::StructorType) + 461
11 clang-3.5                0x000000010cafc437
emitCXXConstructor(clang::CodeGen::CodeGenModule&, clang::CXXConstructorDecl
const*, clang::CodeGen::StructorType) + 39
12 clang-3.5                0x000000010cafc3da (anonymous
namespace)::MicrosoftCXXABI::emitCXXStructor(clang::CXXMethodDecl const*,
clang::CodeGen::StructorType) + 74
13 clang-3.5                0x000000010ca002d1
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 417
14 clang-3.5                0x000000010ca03a7c
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1084
15 clang-3.5                0x000000010caf738e (anonymous
namespace)::MicrosoftCXXABI::EmitCXXConstructors(clang::CXXConstructorDecl
const*) + 62
16 clang-3.5                0x000000010ca06c95
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 853
17 clang-3.5                0x000000010cb0ad1d (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 157
18 clang-3.5                0x000000010c9e50bf
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 207
19 clang-3.5                0x000000010de6e06f
clang::Sema::InstantiateClassMembers(clang::SourceLocation,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind) + 975
20 clang-3.5                0x000000010de6ecfb
clang::Sema::InstantiateClassTemplateSpecializationMembers(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind) +
155
21 clang-3.5                0x000000010dd9168e
clang::Sema::ActOnExplicitInstantiation(clang::Scope*, clang::SourceLocation,
clang::SourceLocation, unsigned int, clang::SourceLocation, clang::CXXScopeSpec
const&, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation,
clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>,
clang::SourceLocation, clang::AttributeList*) + 2958
22 clang-3.5                0x000000010d501865
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 7173
23 clang-3.5                0x000000010d4e4601
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 10593
24 clang-3.5                0x000000010d56aa93
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 755
25 clang-3.5                0x000000010d569f82
clang::Parser::ParseExplicitInstantiation(unsigned int, clang::SourceLocation,
clang::SourceLocation, clang::SourceLocation&, clang::AccessSpecifier) + 242
26 clang-3.5                0x000000010d569e40
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 176
27 clang-3.5                0x000000010d4e178e
clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 462
28 clang-3.5                0x000000010d57bdf3
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2403
29 clang-3.5                0x000000010d57b445
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 773
30 clang-3.5                0x000000010d4d320c clang::ParseAST(clang::Sema&,
bool, bool) + 988
31 clang-3.5                0x000000010c41edea
clang::ASTFrontendAction::ExecuteAction() + 522
32 clang-3.5                0x000000010c9e3833
clang::CodeGenAction::ExecuteAction() + 3939
33 clang-3.5                0x000000010c41e368 clang::FrontendAction::Execute()
+ 120
34 clang-3.5                0x000000010c3b0219
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1017
35 clang-3.5                0x000000010c4905e1
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3201
36 clang-3.5                0x000000010afb0930 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 2496
37 clang-3.5                0x000000010afa2ebb
ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) + 171
38 clang-3.5                0x000000010afa1d2b main + 1275
39 libdyld.dylib            0x00007fff9a5325c9 start + 1
40 libdyld.dylib            0x000000000000003f start + 1705826935
Stack dump:
0.    Program arguments: /Users/ehsan/src/llvm-objdir/bin/clang-3.5 -cc1
-triple i386-apple-windows-msvc -emit-obj -mrelax-all -disable-free
-main-file-name test.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose
-mconstructor-aliases -target-cpu pentium4 -D_MT --dependent-lib=libcmt
--dependent-lib=oldnames -fdiagnostics-format msvc -target-linker-version 241.9
-dwarf-column-info -resource-dir
/Users/ehsan/src/llvm-objdir/bin/../lib/clang/3.6.0 -internal-isystem
/Users/ehsan/src/llvm-objdir/bin/../lib/clang/3.6.0/include -internal-isystem
C:/Program Files/Microsoft Visual Studio 10.0/VC/include -internal-isystem
C:/Program Files/Microsoft Visual Studio 9.0/VC/include -internal-isystem
C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include
-internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/include
-internal-isystem C:/Program Files/Microsoft Visual Studio
8/VC/PlatformSDK/Include -std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/Users/ehsan/src/llvm-objdir -ferror-limit 19 -fmessage-length 180
-mstackrealign -fms-extensions -fms-compatibility
-fms-compatibility-version=17.00 -fdelayed-template-parsing -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/ry/m4kkhrl17c76cqyfd5qv5sph0000gn/T/test-63b084.obj -x c++
test.cpp
1.    test.cpp:9:34: current parser token ';'
2.    test.cpp:6:13: LLVM IR generation of declaration
'SecurityWrapper<A>::SecurityWrapper'
3.    test.cpp:6:13: Generating code for declaration
'SecurityWrapper<A>::SecurityWrapper'
clang-3.5: error: unable to execute command: Illegal instruction: 4
clang-3.5: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0
Target: i386-apple-windows-msvc
Thread model: posix
clang-3.5: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.5: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.5: note: diagnostic msg:
/var/folders/ry/m4kkhrl17c76cqyfd5qv5sph0000gn/T/test-96b7b6.cpp
clang-3.5: note: diagnostic msg:
/var/folders/ry/m4kkhrl17c76cqyfd5qv5sph0000gn/T/test-96b7b6.sh
clang-3.5: note: diagnostic msg:

********************</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>