Add missing NULL check in CanBeType
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
//@error
|
//@error
|
||||||
//assigning mismatched polymorphic types
|
//assigning mismatched polymorphic types
|
||||||
|
|
||||||
export void foo(floating$0 bar) {
|
export void foo(uniform floating$0 bar) {
|
||||||
floating$1 baz = bar;
|
floating$1 baz = bar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//@error
|
//@error
|
||||||
//assigning mismatched polymorphic types
|
//assigning mismatched polymorphic types
|
||||||
|
|
||||||
export void foo(number$0 bar) {
|
export void foo(uniform floating$0 bar) {
|
||||||
floating$0 baz = bar;
|
integer baz = bar;
|
||||||
}
|
}
|
||||||
|
|||||||
20
type.cpp
20
type.cpp
@@ -855,15 +855,17 @@ PolyType::CanBeType(const Type *t) const {
|
|||||||
|
|
||||||
const AtomicType *at = CastType<AtomicType>(t);
|
const AtomicType *at = CastType<AtomicType>(t);
|
||||||
|
|
||||||
switch (restriction) {
|
if (at) {
|
||||||
case TYPE_INTEGER:
|
switch (restriction) {
|
||||||
return at->IsIntType();
|
case TYPE_INTEGER:
|
||||||
case TYPE_FLOATING:
|
return at->IsIntType();
|
||||||
return at->IsFloatType();
|
case TYPE_FLOATING:
|
||||||
case TYPE_NUMBER:
|
return at->IsFloatType();
|
||||||
return at->IsIntType() || at->IsFloatType();
|
case TYPE_NUMBER:
|
||||||
default:
|
return at->IsIntType() || at->IsFloatType();
|
||||||
FATAL("Unmatched case for polymorphic restriction");
|
default:
|
||||||
|
FATAL("Unmatched case for polymorphic restriction");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// not an atomic type or polymorphic type
|
// not an atomic type or polymorphic type
|
||||||
|
|||||||
Reference in New Issue
Block a user