[cfe-commits] r103872 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGenCXX/nrvo.cpp

Douglas Gregor dgregor at apple.com
Mon May 17 08:28:20 PDT 2010


On May 16, 2010, at 8:40 PM, Eli Friedman wrote:

> On Sat, May 15, 2010 at 9:39 AM, Douglas Gregor <dgregor at apple.com> wrote:
>> Author: dgregor
>> Date: Sat May 15 11:39:56 2010
>> New Revision: 103872
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=103872&view=rev
>> Log:
>> When applying the named return value optimization, we still need to
>> destroy the variable along the exceptional edge; it's only during
>> normal execution that we avoid destroying this variable.
> 
> Only loosely relevant to this commit, but it looks like the following
> case is mishandled; the generated code never calls printf:
> 
> extern "C" void exit(int) throw();
> extern "C" int printf(const char*,...) throw();
> struct A {
>  int x;
>  A() {}
>  A(const A&) { printf("Copying\n"); }
>  ~A() { printf("Destroying\n"); }
> };
> A f(int x) {
>  {
>    A y;
>    if (x)
>      return y;
>  }
>  exit(1);
> }


Thanks for pointing this out; I'm on it.

	- Doug



More information about the cfe-commits mailing list