[LLVMbugs] [Bug 10457] Delegating constructor template doesn't seem to delegate

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Oct 30 08:55:57 PDT 2011


show_bug.cgi?id=10457

jonathan.sauer at gmx.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |jonathan.sauer at gmx.de
         Resolution|FIXED                       |

--- Comment #3 from jonathan.sauer at gmx.de 2011-10-30 10:55:57 CDT ---
After the fix, clang r143312 crashes when compiling the following program:

struct Foo {
    Foo(int) { }


    template <typename T>
    Foo(T, int i) : Foo(i) { }
};

int main(int, char**)
{
    Foo    f(1, 1);
}


$clang++ -std=c++0x clang.cpp

Assertion failed: (!CurContext->isDependentContext()), function
BuildDelegatingInitializer, file
/Users/rynnsauer/LLVM/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp, line 2161.
0  clang             0x00000001012afac2 PrintStackTrace(void*) + 34
1  clang             0x00000001012aff49 SignalHandler(int) + 697
2  libSystem.B.dylib 0x00007fff83db41ba _sigtramp + 26
3  libSystem.B.dylib 0x00007fff5fbfa740 _sigtramp + 3689178528
4  clang             0x00000001000188e6 abort + 22
5  clang             0x00000001000188a5 __assert_rtn + 53
6  clang             0x000000010038bad9
clang::Sema::BuildDelegatingInitializer(clang::TypeSourceInfo*,
clang::MultiInitializer const&, clang::SourceLocation, clang::CXXRecordDecl*) +
793
7  clang             0x000000010038af67
clang::Sema::BuildBaseInitializer(clang::QualType, clang::TypeSourceInfo*,
clang::MultiInitializer const&, clang::CXXRecordDecl*, clang::SourceLocation) +
727
8  clang             0x0000000100389f03
clang::Sema::BuildMemInitializer(clang::Decl*, clang::Scope*,
clang::CXXScopeSpec&, clang::IdentifierInfo*,
clang::OpaquePtr<clang::QualType>, clang::SourceLocation,
clang::MultiInitializer const&, clang::SourceLocation) + 3811
9  clang             0x000000010038a044
clang::Sema::ActOnMemInitializer(clang::Decl*, clang::Scope*,
clang::CXXScopeSpec&, clang::IdentifierInfo*,
clang::OpaquePtr<clang::QualType>, clang::SourceLocation,
clang::SourceLocation, clang::Expr**, unsigned int, clang::SourceLocation,
clang::SourceLocation) + 100
10 clang             0x000000010027684c
clang::Parser::ParseMemInitializer(clang::Decl*) + 892
11 clang             0x0000000100276191
clang::Parser::ParseConstructorInitializer(clang::Decl*) + 449
12 clang             0x000000010025a1bc
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 412
13 clang             0x0000000100259bb4
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 132
14 clang             0x0000000100272af2
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 3122
[...]

1.    clang.cpp:6:25: current parser token '{'
2.    clang.cpp:1:1: parsing struct/union/class body 'Foo'
clang: error: unable to execute command: Illegal instruction


If the template parameter T is actually used in the constructor, the code
compiles.

-- 
Configure bugmail: 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