[cfe-commits] r138239 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/SemaCXX/references.cpp

Eli Friedman eli.friedman at gmail.com
Mon Aug 22 15:40:40 PDT 2011

On Mon, Aug 22, 2011 at 10:24 AM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Author: chandlerc
> Date: Mon Aug 22 12:24:56 2011
> New Revision: 138239
> URL: http://llvm.org/viewvc/llvm-project?rev=138239&view=rev
> Log:
> Fix a crash-on-valid that has been here for a very long time:
>  const int &x = x;
> This crashed by inifinetly recursing within the lvalue evaluation
> routine. I've added a (somewhat) braindead way of preventing this
> recursion. If folks have better suggestions for how to avoid it I'm all
> ears.

Well, I definitely agree this is braindead; actually, it's a bit too
braindead.  Take the following:

extern int& x;
int& y = x;
int& x = y;

We probably want to do this the same way we do other kinds of
recursion into decl's for expr evaluation; see setEvaluatedValue etc.


More information about the cfe-commits mailing list