public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54975] New: [C++11] cv-qualifiers of typedef-name are ignored in lambda expression
@ 2012-10-18 13:30 ai.azuma at gmail dot com
  2012-11-30 11:22 ` [Bug c++/54975] [4.7/4.8 Regression] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ai.azuma at gmail dot com @ 2012-10-18 13:30 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54975
           Summary: [C++11] cv-qualifiers of typedef-name are ignored in
                    lambda expression
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ai.azuma@gmail.com


Created attachment 28485
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28485
Output of -v option and preprocessed file with GCC 4.8.0 20121014

The following valid code reproduces the problem;

/////////////////////////////
template<typename T>
struct identity
{
  typedef T type;
};

template<typename T>
void f()
{
  typedef typename T::type A;
  int i = 42;
  int const &cri = i;
  int volatile &vri = i;
  [&]() {
    A const &x = cri;    // Problem here
    A volatile &y = vri; // Likewise
  };
}

int main()
{
  f<identity<int> >();
}
/////////////////////////////

In the lambda-expression, initilizations of cv-qualified references are
obviously legal. However, GCC 4.8.0 20121014 complains as follows;

main.cpp: In instantiation of 'f() [with T = identity<int>]::__lambda0':
main.cpp:16:21:   required from 'struct f() [with T =
identity<int>]::__lambda0'
main.cpp:14:3:   required from 'void f() [with T = identity<int>]'
main.cpp:22:21:   required from here
main.cpp:15:18: error: invalid initialization of reference of type
'identity<int>::type& {aka int&}' from expression of type 'const int'
     A const &x = cri;
                  ^
main.cpp:16:21: error: invalid initialization of reference of type
'identity<int>::type& {aka int&}' from expression of type 'volatile int'
     A volatile &y = vri;
                     ^

The error messages look as if there were no cv-qualifiers in the declarators.

Note that GCC 4.7.3 20121013 also fails to compile, but GCC 4.6.4 20121012
compiles successfully.


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

* [Bug c++/54975] [4.7/4.8 Regression] cv-qualifiers of typedef-name are ignored in lambda expression
  2012-10-18 13:30 [Bug c++/54975] New: [C++11] cv-qualifiers of typedef-name are ignored in lambda expression ai.azuma at gmail dot com
@ 2012-11-30 11:22 ` paolo.carlini at oracle dot com
  2012-12-07  9:53 ` paolo at gcc dot gnu.org
  2012-12-07  9:55 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-30 11:22 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-30
            Summary|[C++11] cv-qualifiers of    |[4.7/4.8 Regression]
                   |typedef-name are ignored in |cv-qualifiers of
                   |lambda expression           |typedef-name are ignored in
                   |                            |lambda expression
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-30 11:22:04 UTC ---
Thus this seems a regression.


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

* [Bug c++/54975] [4.7/4.8 Regression] cv-qualifiers of typedef-name are ignored in lambda expression
  2012-10-18 13:30 [Bug c++/54975] New: [C++11] cv-qualifiers of typedef-name are ignored in lambda expression ai.azuma at gmail dot com
  2012-11-30 11:22 ` [Bug c++/54975] [4.7/4.8 Regression] " paolo.carlini at oracle dot com
@ 2012-12-07  9:53 ` paolo at gcc dot gnu.org
  2012-12-07  9:55 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-12-07  9:53 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-12-07 09:53:14 UTC ---
Author: paolo
Date: Fri Dec  7 09:53:04 2012
New Revision: 194297

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194297
Log:
2012-12-07  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/54975
    * g++.dg/cpp0x/lambda/lambda-typedef.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-typedef.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/54975] [4.7/4.8 Regression] cv-qualifiers of typedef-name are ignored in lambda expression
  2012-10-18 13:30 [Bug c++/54975] New: [C++11] cv-qualifiers of typedef-name are ignored in lambda expression ai.azuma at gmail dot com
  2012-11-30 11:22 ` [Bug c++/54975] [4.7/4.8 Regression] " paolo.carlini at oracle dot com
  2012-12-07  9:53 ` paolo at gcc dot gnu.org
@ 2012-12-07  9:55 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-12-07  9:55 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-12-07 09:54:44 UTC ---
Fixed for 4.7.3 and 4.8 by patch for bug 55058.


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

end of thread, other threads:[~2012-12-07  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-18 13:30 [Bug c++/54975] New: [C++11] cv-qualifiers of typedef-name are ignored in lambda expression ai.azuma at gmail dot com
2012-11-30 11:22 ` [Bug c++/54975] [4.7/4.8 Regression] " paolo.carlini at oracle dot com
2012-12-07  9:53 ` paolo at gcc dot gnu.org
2012-12-07  9:55 ` paolo.carlini at oracle 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).