public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67961] New: Incorrect type of meber of struct in error message
@ 2015-10-14 8:48 other+gcc at meresinski dot eu
2015-10-14 14:14 ` [Bug c++/67961] " redi at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: other+gcc at meresinski dot eu @ 2015-10-14 8:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67961
Bug ID: 67961
Summary: Incorrect type of meber of struct in error message
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: other+gcc at meresinski dot eu
Target Milestone: ---
Created attachment 36506
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36506&action=edit
Test case
Compiling following code produces incorrect error message:
#include <cstdint>
void foo(std::size_t &f) {
f = 5;
}
struct A {
uint32_t val;
};
int main() {
A a, *aptr = &a;
foo(aptr->val);
return 0;
}
g++ --std=c++11 foo.cpp gives error message:
error: invalid initialization of non-const reference of type ‘std::size_t& {aka
long unsigned int&}’ from an rvalue of type ‘std::size_t {aka long unsigned
int}’
foo(aptr->val);
^
where type of that rvalue variable is uint32_t not std::size_t. I think I
should add that system is 64bit so std::size_t has 64 bits.
>From gcc-bugs-return-499522-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Oct 14 09:37:24 2015
Return-Path: <gcc-bugs-return-499522-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24867 invoked by alias); 14 Oct 2015 09:37:24 -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 24804 invoked by uid 48); 14 Oct 2015 09:37:19 -0000
From: "ienkovich at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/67920] [6 Regression] wrong code with -O3
Date: Wed, 14 Oct 2015 09:37: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: 6.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ienkovich at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-67920-4-Isd0g5AQ0R@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67920-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67920-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: 2015-10/txt/msg01077.txt.bz2
Content-length: 507
https://gcc.gnu.org/bugzilla/show_bug.cgi?idg920
Ilya Enkovich <ienkovich at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Ilya Enkovich <ienkovich at gcc dot gnu.org> ---
(In reply to James Almer from comment #9)
> Looks like it did. Thanks.
Fixed then
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67961] Incorrect type of meber of struct in error message
2015-10-14 8:48 [Bug c++/67961] New: Incorrect type of meber of struct in error message other+gcc at meresinski dot eu
@ 2015-10-14 14:14 ` redi at gcc dot gnu.org
2015-10-14 14:26 ` redi at gcc dot gnu.org
2015-10-15 9:11 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-14 14:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67961
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The diagnostic is correct.
Trying to pass uint32_t to a function taking size_t causes a conversion,
creating a temporary (i.e. rvalue) size_t, but a non-const reference cannot
bind to a temporary.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67961] Incorrect type of meber of struct in error message
2015-10-14 8:48 [Bug c++/67961] New: Incorrect type of meber of struct in error message other+gcc at meresinski dot eu
2015-10-14 14:14 ` [Bug c++/67961] " redi at gcc dot gnu.org
@ 2015-10-14 14:26 ` redi at gcc dot gnu.org
2015-10-15 9:11 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-14 14:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67961
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to other+gcc from comment #0)
> where type of that rvalue variable is uint32_t not std::size_t.
There is no rvalue of type uint32_t. The type of the **lvalue** is uint32_t.
The rvalue is the temporary that gets created implicitly, which is of type
size_t.
FWIW clang doesn't mention rvalues, it just says there is no matching function
for the call because ...
prog.cc:4:6: note: candidate function not viable: no known conversion from
'std::uint32_t' (aka 'unsigned int') to 'std::size_t &' (aka 'unsigned long &')
for 1st argument
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67961] Incorrect type of meber of struct in error message
2015-10-14 8:48 [Bug c++/67961] New: Incorrect type of meber of struct in error message other+gcc at meresinski dot eu
2015-10-14 14:14 ` [Bug c++/67961] " redi at gcc dot gnu.org
2015-10-14 14:26 ` redi at gcc dot gnu.org
@ 2015-10-15 9:11 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-10-15 9:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67961
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Closing then.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-15 9:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-14 8:48 [Bug c++/67961] New: Incorrect type of meber of struct in error message other+gcc at meresinski dot eu
2015-10-14 14:14 ` [Bug c++/67961] " redi at gcc dot gnu.org
2015-10-14 14:26 ` redi at gcc dot gnu.org
2015-10-15 9:11 ` 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).