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.