r220940 - ASTDumper.cpp: Appease g++, for now.

Richard Smith richard at metafoo.co.uk
Thu Oct 30 18:15:44 PDT 2014


On Thu, Oct 30, 2014 at 5:56 PM, NAKAMURA Takumi <geek4civic at gmail.com>
wrote:

> http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3/builds/1739
> http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/29232
>
> I am still confused. FYI, g++-4.8.1 is not affected.


Ah, I see what the gcc bug is. When we have:

struct X {
  int n;
  void f() {
    [=] { n = 0; };
  }
};

... the 'n' should not be 'const' (because it's rewritten as this->n, and
'this' is a pointer-to-non-const), but something in its logic for adding
'const' to captures in non-mutable lambdas is going wrong.

Is this the same version of g++ that had the other lambda-related
rejects-valid?


> 2014-10-31 9:50 GMT+09:00 Richard Smith <richard at metafoo.co.uk>:
> > On Thu, Oct 30, 2014 at 5:30 PM, NAKAMURA Takumi <geek4civic at gmail.com>
> > wrote:
> >>
> >> Author: chapuni
> >> Date: Thu Oct 30 19:30:37 2014
> >> New Revision: 220940
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=220940&view=rev
> >> Log:
> >> ASTDumper.cpp: Appease g++, for now.
> >
> >
> > Thanks!
> >
> >>
> >> Modified:
> >>     cfe/trunk/lib/AST/ASTDumper.cpp
> >>
> >> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=220940&r1=220939&r2=220940&view=diff
> >>
> >>
> ==============================================================================
> >> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> >> +++ cfe/trunk/lib/AST/ASTDumper.cpp Thu Oct 30 19:30:37 2014
> >> @@ -152,8 +152,8 @@ namespace  {
> >>            OS << '\n';
> >>            ColorScope Color(*this, IndentColor);
> >>            OS << Prefix << (isLastChild ? '`' : '|') << '-';
> >> -          Prefix.push_back(isLastChild ? ' ' : '|');
> >> -          Prefix.push_back(' ');
> >> +          this->Prefix.push_back(isLastChild ? ' ' : '|');
> >> +          this->Prefix.push_back(' ');
> >>          }
> >>
> >>          FirstChild = true;
> >> @@ -166,11 +166,11 @@ namespace  {
> >>          // Dump those ones out now.
> >>          while (Depth < Pending.size()) {
> >>            Pending.back()(true);
> >
> >
> > Do you need to also change these references to Pending...
> >
> >>
> >> -          Pending.pop_back();
> >> +          this->Pending.pop_back();
> >>          }
> >>
> >>          // Restore the old prefix.
> >> -        Prefix.resize(Prefix.size() - 2);
> >> +        this->Prefix.resize(Prefix.size() - 2);
> >
> >
> > ... and the second reference to Prefix here?
> >
> > What error does g++ give here?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141030/2e765148/attachment.html>


More information about the cfe-commits mailing list