public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates
@ 2012-05-25 14:09 omawarisan.bokudesu at live dot jp
  2012-05-25 15:07 ` [Bug c++/53484] [4.7/4.8 Regression] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: omawarisan.bokudesu at live dot jp @ 2012-05-25 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53484
           Summary: [c++11] Wrong auto in lambdas in function templates
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: omawarisan.bokudesu@live.jp


In the following program, auto is deduced to be int&, while int is expected.

template <class T>
void f(T x){
   [&]{
       std::cout << x << std::endl;
       auto y = x;
       y = 100;
       std::cout << x << std::endl;
   }();
}

int main(){ f(0); }

output:
0
100

In non-template functions, it doesn't occur.

------------
revision r187865

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/user/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/user/gcc-trunk
--disable-bootstrap --disable-multilib --enable-languages=c,c++,fortran
--with-gmp=/home/user/gcc-trunk/src/build/backends
--with-mpfr=/home/user/gcc-trunk/src/build/backends
--with-mpc=/home/user/gcc-trunk/src/build/backends
Thread model: posix
gcc version 4.8.0 20120525 (experimental) (GCC)


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

* [Bug c++/53484] [4.7/4.8 Regression] [c++11] Wrong auto in lambdas in function templates
  2012-05-25 14:09 [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates omawarisan.bokudesu at live dot jp
@ 2012-05-25 15:07 ` redi at gcc dot gnu.org
  2012-05-29 14:32 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-25 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.6.3
           Keywords|                            |rejects-valid, wrong-code
   Last reconfirmed|                            |2012-05-25
                 CC|                            |jason at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|[c++11] Wrong auto in       |[4.7/4.8 Regression]
                   |lambdas in function         |[c++11] Wrong auto in
                   |templates                   |lambdas in function
                   |                            |templates
      Known to fail|                            |4.7.0, 4.8.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-25 14:49:55 UTC ---
Regression against 4.6.3

Possibly related, the example in [expr.prim.lambda]/18 fails to compile with
4.7 and 4.8

void f3() {
    float x, &r = x;
    [=] { // x and r are not captured (appearance in a decltype operand is not
an odr-use)
        decltype(x) y1; // y1 has type float
        decltype((x)) y2 = y1; // y2 has type float const& because this lambda
        // is not mutable and x is an lvalue
        decltype(r) r1 = y1; // r1 has type float& (transformation not
considered)
        decltype((r)) r2 = y2; // r2 has type float const&
    };
}


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

* [Bug c++/53484] [4.7/4.8 Regression] [c++11] Wrong auto in lambdas in function templates
  2012-05-25 14:09 [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates omawarisan.bokudesu at live dot jp
  2012-05-25 15:07 ` [Bug c++/53484] [4.7/4.8 Regression] " redi at gcc dot gnu.org
@ 2012-05-29 14:32 ` rguenth at gcc dot gnu.org
  2012-05-31 15:55 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-29 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Target Milestone|---                         |4.7.1


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

* [Bug c++/53484] [4.7/4.8 Regression] [c++11] Wrong auto in lambdas in function templates
  2012-05-25 14:09 [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates omawarisan.bokudesu at live dot jp
  2012-05-25 15:07 ` [Bug c++/53484] [4.7/4.8 Regression] " redi at gcc dot gnu.org
  2012-05-29 14:32 ` rguenth at gcc dot gnu.org
@ 2012-05-31 15:55 ` jason at gcc dot gnu.org
  2012-06-01 16:55 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-05-31 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

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


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

* [Bug c++/53484] [4.7/4.8 Regression] [c++11] Wrong auto in lambdas in function templates
  2012-05-25 14:09 [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates omawarisan.bokudesu at live dot jp
                   ` (2 preceding siblings ...)
  2012-05-31 15:55 ` jason at gcc dot gnu.org
@ 2012-06-01 16:55 ` jason at gcc dot gnu.org
  2012-06-01 18:43 ` jason at gcc dot gnu.org
  2012-06-01 18:45 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-01 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-01 16:55:15 UTC ---
Author: jason
Date: Fri Jun  1 16:55:08 2012
New Revision: 188116

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188116
Log:
    PR c++/53484
    * pt.c (do_auto_deduction): Don't try to deduce from a
    type-dependent initializer.

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


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

* [Bug c++/53484] [4.7/4.8 Regression] [c++11] Wrong auto in lambdas in function templates
  2012-05-25 14:09 [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates omawarisan.bokudesu at live dot jp
                   ` (3 preceding siblings ...)
  2012-06-01 16:55 ` jason at gcc dot gnu.org
@ 2012-06-01 18:43 ` jason at gcc dot gnu.org
  2012-06-01 18:45 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-01 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-01 18:43:30 UTC ---
Author: jason
Date: Fri Jun  1 18:43:23 2012
New Revision: 188122

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188122
Log:
    PR c++/53484
    * pt.c (do_auto_deduction): Don't try to deduce from a
    type-dependent initializer.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/auto33.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/53484] [4.7/4.8 Regression] [c++11] Wrong auto in lambdas in function templates
  2012-05-25 14:09 [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates omawarisan.bokudesu at live dot jp
                   ` (4 preceding siblings ...)
  2012-06-01 18:43 ` jason at gcc dot gnu.org
@ 2012-06-01 18:45 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-01 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-01 18:44:57 UTC ---
Fixed for 4.7.1.


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

end of thread, other threads:[~2012-06-01 18:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-25 14:09 [Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates omawarisan.bokudesu at live dot jp
2012-05-25 15:07 ` [Bug c++/53484] [4.7/4.8 Regression] " redi at gcc dot gnu.org
2012-05-29 14:32 ` rguenth at gcc dot gnu.org
2012-05-31 15:55 ` jason at gcc dot gnu.org
2012-06-01 16:55 ` jason at gcc dot gnu.org
2012-06-01 18:43 ` jason at gcc dot gnu.org
2012-06-01 18:45 ` 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).