public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions
@ 2013-01-09 10:08 daniel.kruegler at googlemail dot com
  2013-01-09 10:24 ` [Bug c++/55914] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-01-09 10:08 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55914
           Summary: [C++11] Pack expansion for class member expression
                    fails in lambda expressions
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


The following code, compiled with 

-Wall -std=c++11 -pedantic

is rejected by gcc 4.7.2 and gcc 4.8.0 20130106 (experimental):

//---------------------
struct S {
  int foo(){ return 0; }
};

template<class... Args>
void evaluate(Args...){}

template <class... Args>
void bar(Args... args) {
  evaluate(args.foo()...); // OK
  auto lmb = [=](){ evaluate(args.foo()...); }; // Error
  lmb();
}

int main() {
  S s{};
  bar(s);
}
//---------------------

"11|error: parameter packs not expanded with '...':|
11|note:         'args'|
In instantiation of 'void bar(Args ...) [with Args = {S}]':|
17|required from here|
11|error: using invalid field 'bar(Args ...)::__lambda0::__args'|
"

The problem also occurs for class member expressions of the form E1->E2 instead
of E1.E2.


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

* [Bug c++/55914] [C++11] Pack expansion for class member expression fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
@ 2013-01-09 10:24 ` paolo.carlini at oracle dot com
  2013-01-09 10:39 ` daniel.kruegler at googlemail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-09 10:24 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |54367

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-09 10:23:56 UTC ---
I suspect this is just a different manifestation of PR41933.


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

* [Bug c++/55914] [C++11] Pack expansion for class member expression fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
  2013-01-09 10:24 ` [Bug c++/55914] " paolo.carlini at oracle dot com
@ 2013-01-09 10:39 ` daniel.kruegler at googlemail dot com
  2013-01-09 10:56 ` [Bug c++/55914] [C++11] Pack expansion " paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-01-09 10:39 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-01-09 10:39:29 UTC ---
(In reply to comment #1)
> I suspect this is just a different manifestation of PR41933.

Thanks Paolo, I partially agree. Indeed the problem is not depending on class
member expressions (so the issue title should be fixed), a simplified example
can be written as:

//--------------------
struct S {};

template<class... Args>
void evaluate(Args...){}

template <class... Args>
void bar(Args... args) {
  evaluate(args...); // OK
  auto lmb = [=](){ evaluate(args...); }; // Error
  lmb();
}

int main() {
  S s{};
  bar(s);
}
//--------------------

with the error:

"9|error: parameter packs not expanded with '...':|
9|note:         'args'|
9|error: expansion pattern 'args' contains no argument packs|
|In instantiation of 'void bar(Args ...) [with Args = {S}]':|
15|required from here|
9|error: using invalid field 'bar(Args ...)::__lambda0::__args'|"

The reason why I hesitate to agree with that being a dup of bug 41933 is due to
the fact that the corresponding example there depends on a language extension
described in

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#904

that is not part of C++11. I do think though, that my revised example above is
indeed conforming C++11 because it does not depend on that grammar extension.

Please keep that in mind when considering the category change to DUP, because
that would have impact on which versions of gcc to patch. For example, I assume
that any CWG defect 904 association would presumably not be applied to gcc
4.7.2.


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

* [Bug c++/55914] [C++11] Pack expansion fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
  2013-01-09 10:24 ` [Bug c++/55914] " paolo.carlini at oracle dot com
  2013-01-09 10:39 ` daniel.kruegler at googlemail dot com
@ 2013-01-09 10:56 ` paolo.carlini at oracle dot com
  2013-01-09 11:00 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-09 10:56 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-09
     Ever Confirmed|0                           |1

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-09 10:56:03 UTC ---
Thanks Daniel, don't worry I'm not going to close anything for now. But we
should really clarify in PR41933 that the issue isn't about C++11 proper.


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

* [Bug c++/55914] [C++11] Pack expansion fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2013-01-09 10:56 ` [Bug c++/55914] [C++11] Pack expansion " paolo.carlini at oracle dot com
@ 2013-01-09 11:00 ` paolo.carlini at oracle dot com
  2013-01-09 11:38 ` daniel.kruegler at googlemail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-09 11:00 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-09 10:59:54 UTC ---
Daniel, are you sure PR41933 isn't C++11 proper? I gather that the
corresponding Core issue (which at the time Jason also referenced) went into
CD2, thus isn't just C++11?!?


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

* [Bug c++/55914] [C++11] Pack expansion fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2013-01-09 11:00 ` paolo.carlini at oracle dot com
@ 2013-01-09 11:38 ` daniel.kruegler at googlemail dot com
  2013-07-04  8:32 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-01-09 11:38 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-01-09 11:37:49 UTC ---
(In reply to comment #4)
You are right, I missed the CD2 tag


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

* [Bug c++/55914] [C++11] Pack expansion fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2013-01-09 11:38 ` daniel.kruegler at googlemail dot com
@ 2013-07-04  8:32 ` paolo.carlini at oracle dot com
  2013-09-21  8:57 ` paolo.carlini at oracle dot com
  2014-11-20 15:49 ` balakrishnan.erode at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-04  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lb-guilherme at live dot com

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 57817 has been marked as a duplicate of this bug. ***


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

* [Bug c++/55914] [C++11] Pack expansion fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
                   ` (5 preceding siblings ...)
  2013-07-04  8:32 ` paolo.carlini at oracle dot com
@ 2013-09-21  8:57 ` paolo.carlini at oracle dot com
  2014-11-20 15:49 ` balakrishnan.erode at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-21  8:57 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.9.0
         Resolution|---                         |FIXED

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0 by the patch which fixed c++/41933.


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

* [Bug c++/55914] [C++11] Pack expansion fails in lambda expressions
  2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
                   ` (6 preceding siblings ...)
  2013-09-21  8:57 ` paolo.carlini at oracle dot com
@ 2014-11-20 15:49 ` balakrishnan.erode at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: balakrishnan.erode at gmail dot com @ 2014-11-20 15:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55914

Balakrishnan B <balakrishnan.erode at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |balakrishnan.erode at gmail dot co
                   |                            |m

--- Comment #8 from Balakrishnan B <balakrishnan.erode at gmail dot com> ---
Is this bug fixed in 4.8.3? I don't find here

Known to work:    4.9.0
Known to fail:    4.7.2, 4.8.0


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

end of thread, other threads:[~2014-11-20 15:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-09 10:08 [Bug c++/55914] New: [C++11] Pack expansion for class member expression fails in lambda expressions daniel.kruegler at googlemail dot com
2013-01-09 10:24 ` [Bug c++/55914] " paolo.carlini at oracle dot com
2013-01-09 10:39 ` daniel.kruegler at googlemail dot com
2013-01-09 10:56 ` [Bug c++/55914] [C++11] Pack expansion " paolo.carlini at oracle dot com
2013-01-09 11:00 ` paolo.carlini at oracle dot com
2013-01-09 11:38 ` daniel.kruegler at googlemail dot com
2013-07-04  8:32 ` paolo.carlini at oracle dot com
2013-09-21  8:57 ` paolo.carlini at oracle dot com
2014-11-20 15:49 ` balakrishnan.erode at gmail dot com

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).