[LLVMbugs] [Bug 7597] New: Crash creating object without defined constructor.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jul 8 11:19:26 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7597
Summary: Crash creating object without defined constructor.
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: dlarimer at gmail.com
CC: llvmbugs at cs.uiuc.edu
I was attempting to compile code with clang that compiled fine with gcc and
VC++. I was unable to determine the exact "cause" of the clang crash because
it could be triggered by various arrangements of the code and showed no clear
"pattern".
If I directly specify the type (instead of using the template parameter) it
works. If I use a template parameter and then instantiate the class with the
template parameter set to the same type it crashes.
If i construct on the stack it works. If I construct via new it crashes clang;
Given the following code
class SomeType{};
template<typename T, template <typename T> DelegateType = DefautlDelegateType >
struct stub
{
// lots of nested struct declarations here.
}
namespace bb {
class server
{
template<typename T>
server( boost::shared_ptr<T>& ptr )
{
stub<SomeType> x; // works
new stub<SomeType>; // works
stub<T> y; // works
new stub<T>; // with T == SomeType crashes clang, unless stub
defines a constructor
}
};
}
Assertion failed: ((Record->hasTrivialCopyConstructor() ||
Record->hasTrivialCopyAssignment()) && "Trying to aggregate-copy a type without
a trivial copy " "constructor or assignment operator"), function
EmitAggregateCopy, file
/Users/dlarimer/projects/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp, line 792.
Stack dump:
0. Program arguments: /usr/local/bin/clang -cc1 -triple
x86_64-apple-darwin10.0.0 -emit-obj -mrelax-all -disable-free -main-file-name
serv.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables
-target-cpu core2 -resource-dir /usr/local/lib/clang/2.8 -D QT_NO_DEBUG_OUTPUT
-D __STDC_LIMIT_MACROS -I /Users/dlarimer/projects/fl/libraries -I
/Users/dlarimer/projects/fl/libraries/core -I
/Users/dlarimer/projects/fl/libraries/drivers -I /usr/local/include
-ferror-limit 19 -fmessage-length 270 -stack-protector 1 -fblocks -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o CMakeFiles/bbs.dir/serv.cpp.o
-x c++ /Users/dlarimer/projects/fl/libraries/fl/backbone/serv.cpp -v
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. /Users/dlarimer/projects/fl/libraries/fl/backbone/server.hpp:20:5:
Generating code for declaration 'bb::server::server'
4. /Users/dlarimer/projects/fl/libraries/fl/backbone/server.hpp:22:5: LLVM
IR generation of compound statement ('{}')
--
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