This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67961] New: Incorrect type of meber of struct in error message
- From: "other+gcc at meresinski dot eu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 14 Oct 2015 08:48:48 +0000
- Subject: [Bug c++/67961] New: Incorrect type of meber of struct in error message
- Auto-submitted: auto-generated
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.