[LLVMbugs] [Bug 8683] New: clang crash on parenthesized initialization of type with nontrivial copy ctor and copy assignment

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 24 11:43:52 PST 2010


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

           Summary: clang crash on parenthesized initialization of type
                    with nontrivial copy ctor and copy assignment
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


(vb is a very simplified version of std::vector<bool> from libstdc++)

$ cat tmp.cpp 
struct bvb {
  bvb();
  bvb(const bvb &);
};
struct vb : bvb {
  vb &operator=(const vb &__x);
};
struct foo {
  vb b;
};
void go() {
  vb tmp = (foo().b);
}
$ clang++ tmp.cpp
clang: <...>/clang-svn/lib/CodeGen/CGExprAgg.cpp:674: void
clang::CodeGen::CodeGenFunction::EmitAggregateCopy(llvm::Value*, llvm::Value*,
clang::QualType, bool): Assertion `(Record->hasTrivialCopyConstructor() ||
Record->hasTrivialCopyAssignment()) && "Trying to aggregate-copy a type without
a trivial copy " "constructor or assignment operator"' failed.
0  libLLVM-2.9svn.so 0xf77d4c48
Stack dump:
0.      Program arguments: <...>/llvm-svn-build/Release+Asserts/bin/clang -cc1
-triple i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
tmp.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.17.50.0.6
-resource-dir <...>/llvm-svn-build/Release+Asserts/bin/../lib/clang/2.9
-ferror-limit 19 -fmessage-length 239 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-Y359oY.o -x c++
tmp.cpp 
1.      <eof> parser at end of file
2.      tmp.cpp:11:6: LLVM IR generation of declaration 'go'
3.      tmp.cpp:11:6: Generating code for declaration 'go'
4.      tmp.cpp:11:11: LLVM IR generation of compound statement ('{}')


Removing the parens around foo().b makes this work. Using a vb instance
directly rather than a field of a function return value makes this work. Adding
a copy ctor to vb makes this work.

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