The IRGen side of this is very, very wrong.  Trying to emit something
which isn't actually odr-used simply isn't correct.  Consider the
following:

struct S { int r; };
struct T {
  static constexpr S cs{3};
};
int main() {
  return [](bool b) { S s{4}; return (b ? s : T::cs).r; }(false);
}

This is a complete, correct C++ program under DR712 (I think), but it
will fail to link with your patch, because it doesn't actually address
the root IRGen issue.

The correct approach probably involves emitting the value into a temporary.

-Eli

On Mon, Jul 15, 2013 at 11:51 AM, Faisal Vali <[email protected]> wrote:
> Hi rsmith, rjmccall,
>
> Please see 
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130708/083442.html
>  for context.
>
> (Trying to learn the phabricator interface - is it preferred that patches be 
> submitted for review through it?)
> thanks!
>
> http://llvm-reviews.chandlerc.com/D1140
>
> Files:
>   lib/CodeGen/CGExpr.cpp
>   lib/Sema/SemaExpr.cpp
>   lib/Sema/SemaExprCXX.cpp
>   test/CodeGenCXX/cxx11-DR712-lambda-constexpr.cpp
>   test/CodeGenCXX/cxx11-member-ptr-constexpr.cpp
>   test/CXX/basic/basic.def.odr/p2-potential-results.cpp
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to