public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda
@ 2014-03-05  2:31 ppluzhnikov at google dot com
  2014-09-19  9:15 ` [Bug c++/60420] " paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2014-03-05  2:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60420
           Summary: [C++11] Bogus "error: ‘const’ qualifiers cannot be
                    applied to ‘int&’" with lambda
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/13305941

Using current (r208339) trunk:

g++ -c -std=c++11 t.cc
t.cc: In instantiation of ‘struct fn(Iterator, Iterator) [with Iterator =
__gnu_cxx::__normal_iterator<int*, std::vector<int> >]::<lambda>’:
t.cc:6:45:   required from ‘void fn(Iterator, Iterator) [with Iterator =
__gnu_cxx::__normal_iterator<int*, std::vector<int> >]’
t.cc:11:26:   required from here
t.cc:6:38: error: ‘const’ qualifiers cannot be applied to ‘int&’
   auto x = [](const decltype(*begin) b) { };
                                      ^
t.cc: In instantiation of ‘struct fn(Iterator, Iterator) [with Iterator =
__gnu_cxx::__normal_iterator<const int*, std::vector<int> >]::<lambda>’:
t.cc:6:45:   required from ‘void fn(Iterator, Iterator) [with Iterator =
__gnu_cxx::__normal_iterator<const int*, std::vector<int> >]’
t.cc:16:26:   required from here
t.cc:6:38: error: ‘const’ qualifiers cannot be applied to ‘const int&’

Clang accepts this test case. GCC-4.8 gives up with "confused by earlier
errors, bailing out" after the first error.



#include <vector>

template <typename Iterator>
void fn(Iterator begin, Iterator end)
{
  auto x = [](const decltype(*begin) b) { };
}

void foo(std::vector<int> &vi)
{
  fn(vi.begin(), vi.end());
}

void bar(const std::vector<int>& vi)
{
  fn(vi.begin(), vi.end());
}
>From gcc-bugs-return-445435-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 05 05:09:19 2014
Return-Path: <gcc-bugs-return-445435-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12481 invoked by alias); 5 Mar 2014 05:09:18 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 12439 invoked by uid 48); 5 Mar 2014 05:09:13 -0000
From: "y.gribov at samsung dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/60419] [4.8 / 4.9 Regression] ICE Segmentation fault
Date: Wed, 05 Mar 2014 05:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: y.gribov at samsung dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-60419-4-cUV0w8YqvN@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60419-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60419-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg00304.txt.bz2
Content-length: 572

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

Yury Gribov <y.gribov at samsung dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |y.gribov at samsung dot com

--- Comment #1 from Yury Gribov <y.gribov at samsung dot com> ---
Attached code seems to be Power-specific:
 ...
 /usr/include/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h:483:56: error:
‘__builtin_vec_sld’ was not declared in this scope
>From gcc-bugs-return-445436-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 05 05:42:32 2014
Return-Path: <gcc-bugs-return-445436-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19193 invoked by alias); 5 Mar 2014 05:42:32 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19155 invoked by uid 48); 5 Mar 2014 05:42:28 -0000
From: "doko at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/60419] [4.8/4.9 Regression] ICE Segmentation fault
Date: Wed, 05 Mar 2014 05:42:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: doko at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60419-4-H5FFWY0lka@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60419-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60419-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg00305.txt.bz2
Content-length: 171

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`419

--- Comment #2 from Matthias Klose <doko at gcc dot gnu.org> ---
yes, the first attachment is for powepc64le-linux-gnu


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

* [Bug c++/60420] [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda
  2014-03-05  2:31 [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda ppluzhnikov at google dot com
@ 2014-09-19  9:15 ` paolo.carlini at oracle dot com
  2014-11-12 11:18 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-09-19  9:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-09-19
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
In mainline we don't ICE anymore. This is enough to reproduce the issue:

struct Iterator
{
  int& operator*();
};

void foo(Iterator begin)
{
  auto x = [](const decltype(*begin)) { };
}

Note, anyway, that the EDG front-end warns.


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

* [Bug c++/60420] [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda
  2014-03-05  2:31 [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda ppluzhnikov at google dot com
  2014-09-19  9:15 ` [Bug c++/60420] " paolo.carlini at oracle dot com
@ 2014-11-12 11:18 ` paolo.carlini at oracle dot com
  2014-11-12 11:25 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-11-12 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm looking into this, and I don't see how we can accept this kind of code
given 8.3.2: "Cv-qualified references are ill-formed except when the
cv-qualifiers are introduced through the use of a typedef (7.1.3) or of a
template type argument (14.3), in which case the cv-qualifiers are ignored.".

Daniel, are you willing to comment?


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

* [Bug c++/60420] [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda
  2014-03-05  2:31 [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda ppluzhnikov at google dot com
  2014-09-19  9:15 ` [Bug c++/60420] " paolo.carlini at oracle dot com
  2014-11-12 11:18 ` paolo.carlini at oracle dot com
@ 2014-11-12 11:25 ` paolo.carlini at oracle dot com
  2014-11-12 11:37 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-11-12 11:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
... unless the "or of a template type argument" part applies (but clang accepts
both the original testcase and my Comment #1?!?)


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

* [Bug c++/60420] [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda
  2014-03-05  2:31 [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda ppluzhnikov at google dot com
                   ` (2 preceding siblings ...)
  2014-11-12 11:25 ` paolo.carlini at oracle dot com
@ 2014-11-12 11:37 ` paolo.carlini at oracle dot com
  2014-11-12 11:44 ` daniel.kruegler at googlemail dot com
  2014-11-12 20:45 ` [Bug c++/60420] [DR 1510] " paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-11-12 11:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
In case a correct reduced reproducer would be:

struct MyIter
{
  int& operator*();
};

template<typename Iterator>
void foo(Iterator begin)
{
  auto x = [](const decltype(*begin)) { };
}

template void foo<MyIter>(MyIter);


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

* [Bug c++/60420] [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda
  2014-03-05  2:31 [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda ppluzhnikov at google dot com
                   ` (3 preceding siblings ...)
  2014-11-12 11:37 ` paolo.carlini at oracle dot com
@ 2014-11-12 11:44 ` daniel.kruegler at googlemail dot com
  2014-11-12 20:45 ` [Bug c++/60420] [DR 1510] " paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-11-12 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Paolo Carlini from comment #2)
> I'm looking into this, and I don't see how we can accept this kind of code
> given 8.3.2: "Cv-qualified references are ill-formed except when the
> cv-qualifiers are introduced through the use of a typedef (7.1.3) or of a
> template type argument (14.3), in which case the cv-qualifiers are ignored.".
> 
> Daniel, are you willing to comment?

The current wording is:

"Cv-qualified references are ill-formed except when the cv-qualifiers are
introduced through the use of a typedef-name (7.1.3, 14.1) or
decltype-specifier (7.1.6.2), in which case the cv-qualifiers are ignored."

Note that this change came in via CWG 1510 addressing CD3:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1510
>From gcc-bugs-return-466509-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 12 12:09:15 2014
Return-Path: <gcc-bugs-return-466509-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6593 invoked by alias); 12 Nov 2014 12:09:15 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 6545 invoked by uid 48); 12 Nov 2014 12:09:11 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60420] [C++11] Bogus "error:=?UTF-8?Q? ‘const’ qualifiers cannot be applied to ‘int&’?=" with lambda
Date: Wed, 12 Nov 2014 12:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60420-4-Fcdk0jzXgx@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60420-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60420-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-11/txt/msg00981.txt.bz2
Content-length: 163

https://gcc.gnu.org/bugzilla/show_bug.cgi?id`420

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Ah, thanks, that explains everything!


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

* [Bug c++/60420] [DR 1510] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda
  2014-03-05  2:31 [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda ppluzhnikov at google dot com
                   ` (4 preceding siblings ...)
  2014-11-12 11:44 ` daniel.kruegler at googlemail dot com
@ 2014-11-12 20:45 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-11-12 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|paolo.carlini at oracle dot com    |
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |5.0

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done for 5.0.


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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-05  2:31 [Bug c++/60420] New: [C++11] Bogus "error: ‘const’ qualifiers cannot be applied to ‘int&’" with lambda ppluzhnikov at google dot com
2014-09-19  9:15 ` [Bug c++/60420] " paolo.carlini at oracle dot com
2014-11-12 11:18 ` paolo.carlini at oracle dot com
2014-11-12 11:25 ` paolo.carlini at oracle dot com
2014-11-12 11:37 ` paolo.carlini at oracle dot com
2014-11-12 11:44 ` daniel.kruegler at googlemail dot com
2014-11-12 20:45 ` [Bug c++/60420] [DR 1510] " 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).