Fix spurious warnings with mingw-w64.
gcc/testsuite/ChangeLog:
* g++.dg/expr/cast11.C: Cast to intptr_t instead of long.
* g++.dg/opt/pr55717.C: Ditto.
* g++.dg/warn/Wunused-value-1.C: Ditto.
Signed-off-by: Jonathan Yong <10walls@gmail.com>
struct B { int i; const char c; } b = {};
+typedef __INTPTR_TYPE__ intptr_t;
+
void f1()
{
int i = 0;
f((long* const)&i); // { dg-warning "5:type qualifiers ignored" }
f(static_cast<long const>(i)); // { dg-warning "5:type qualifiers ignored" }
- f(reinterpret_cast<long const>(&i)); // { dg-warning "5:type qualifiers ignored" }
+ f(reinterpret_cast<intptr_t const>(&i)); // { dg-warning "5:type qualifiers ignored" }
f(static_cast<int* const>(&i)); // { dg-warning "5:type qualifiers ignored" }
f(const_cast<int* const>(&i)); // { dg-warning "5:type qualifiers ignored" }
// { dg-options "-O -g" }
typedef unsigned uint32_t __attribute__((mode (__SI__)));
+typedef __INTPTR_TYPE__ intptr_t;
struct DebugOnly {};
template <class T>
uint32_t offset : 24;
int kind;
typedef AllocationSiteKey Lookup;
- static unsigned hash (AllocationSiteKey key) { return (long (key.script->code + key.offset)) ^ key.kind; }
+ static unsigned hash (AllocationSiteKey key) { return (intptr_t (key.script->code + key.offset)) ^ key.kind; }
};
void
TypeCompartment::sweep (FreeOp *)
// { dg-do compile { target c++11 } }
// { dg-options "-Wunused" }
+typedef __INTPTR_TYPE__ intptr_t;
+
void
g ()
{
- (long) new int{};
- long(new int{});
- (long) new int();
- long(new int());
+ (intptr_t) new int{};
+ intptr_t(new int{});
+ (intptr_t) new int();
+ intptr_t(new int());
}