public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52374] New: [C++11] Fails to transform id-expression into dependent base member access in lambda expression
@ 2012-02-24 16:50 ai.azuma at gmail dot com
  2012-02-24 17:20 ` [Bug c++/52374] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ai.azuma at gmail dot com @ 2012-02-24 16:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52374

             Bug #: 52374
           Summary: [C++11] Fails to transform id-expression into
                    dependent base member access in lambda expression
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ai.azuma@gmail.com


Created attachment 26742
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26742
Output of -v option and preprocessed file

In the lambda expression's compound statement, id-expressions referring to
non-static members should be transformed into class member access expressions
by prefixing `(*this).'. However, GCC fails the transformation when
id-expressions involved are qualified-ids and refer to dependent base members.

A test case is as follows;

////////////////////////////////////////////////////////////////////
struct B
{
  int get() const { return 42; }
};

template<typename X>
struct D
  : public X
{
  int get() const { return [this]() -> int { return X::get(); }(); }
};

int main()
{
  D<B> d;
  d.get();
}

////////////////////////////////////////////////////////////////////

For the above mentioned well-formed code, 4.7.0 20120218 (experimental) with
-std=c++11 complains as follows;

main.cpp: In instantiation of 'D<X>::get() const [with X = B]::<lambda()>':
main.cpp:10:29:   required from 'struct D<X>::get() const [with X =
B]::<lambda()>'
main.cpp:10:65:   required from 'int D<X>::get() const [with X = B]'
main.cpp:16:9:   required from here
main.cpp:10:60: error: cannot call member function 'int B::get() const' without
object

`X::get' in the lambda expression should be implicitly transformed into
`(*this).X::get', and the test case should compile successfully.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52374] [C++11] Fails to transform id-expression into dependent base member access in lambda expression
  2012-02-24 16:50 [Bug c++/52374] New: [C++11] Fails to transform id-expression into dependent base member access in lambda expression ai.azuma at gmail dot com
@ 2012-02-24 17:20 ` redi at gcc dot gnu.org
  2013-03-13  2:53 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-24 17:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52374

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-24
     Ever Confirmed|0                           |1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52374] [C++11] Fails to transform id-expression into dependent base member access in lambda expression
  2012-02-24 16:50 [Bug c++/52374] New: [C++11] Fails to transform id-expression into dependent base member access in lambda expression ai.azuma at gmail dot com
  2012-02-24 17:20 ` [Bug c++/52374] " redi at gcc dot gnu.org
@ 2013-03-13  2:53 ` jason at gcc dot gnu.org
  2013-03-17  2:42 ` jason at gcc dot gnu.org
  2013-03-23 19:24 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-13  2:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52374

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52374] [C++11] Fails to transform id-expression into dependent base member access in lambda expression
  2012-02-24 16:50 [Bug c++/52374] New: [C++11] Fails to transform id-expression into dependent base member access in lambda expression ai.azuma at gmail dot com
  2012-02-24 17:20 ` [Bug c++/52374] " redi at gcc dot gnu.org
  2013-03-13  2:53 ` jason at gcc dot gnu.org
@ 2013-03-17  2:42 ` jason at gcc dot gnu.org
  2013-03-23 19:24 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-17  2:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52374

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-17 02:39:18 UTC ---
Author: jason
Date: Sun Mar 17 02:39:04 2013
New Revision: 196743

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196743
Log:
    PR c++/52374
    * pt.c (tsubst_qualified_id): Use current_nonlambda_class_type.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this13.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52374] [C++11] Fails to transform id-expression into dependent base member access in lambda expression
  2012-02-24 16:50 [Bug c++/52374] New: [C++11] Fails to transform id-expression into dependent base member access in lambda expression ai.azuma at gmail dot com
                   ` (2 preceding siblings ...)
  2013-03-17  2:42 ` jason at gcc dot gnu.org
@ 2013-03-23 19:24 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-23 19:24 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52374

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.1

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-23 19:24:48 UTC ---
Fixed for 4.8.1.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-23 19:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-24 16:50 [Bug c++/52374] New: [C++11] Fails to transform id-expression into dependent base member access in lambda expression ai.azuma at gmail dot com
2012-02-24 17:20 ` [Bug c++/52374] " redi at gcc dot gnu.org
2013-03-13  2:53 ` jason at gcc dot gnu.org
2013-03-17  2:42 ` jason at gcc dot gnu.org
2013-03-23 19:24 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).