hubert.reinterpretcast added inline comments.
================ Comment at: lib/AST/ExprConstant.cpp:5061 + APValue RVal; + // FIXME: We need to make sure we're passing the right type that + // maintains cv-qualifiers. ---------------- faisalv wrote: > rsmith wrote: > > faisalv wrote: > > > I don't think we need this fixme - the type of the expression should be > > > correct - all other const checks for mutability have already been > > > performed, right? > > When using `handleLValueToRValueConversion` to obtain the lvalue denoted by > > a reference, the type you pass should be the reference type itself > > (`FD->getType()`). This approach will give the wrong answer when using a > > captured volatile object: > > ``` > > void f() { > > volatile int n; > > constexpr volatile int *p = [&]{ return &n; }(); // should be accepted > > } > > ``` > OK - but how is the address of a local variable a constant expression? I guess this one is safer: ``` void f() { volatile int n; constexpr volatile int *p = [&]{ return false ? &n : nullptr; }(); } ``` https://reviews.llvm.org/D29748 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits