19728, "mppf", "unexpected implicit conversion from opaque type to int", "2022-04-29T18:40:25Z"
I'm seeing a surprising implicit conversion from an opaque extern
type to int
.
I would have expected a compilation error in this case.
Steps to Reproduce
Source Code:
// myint.h
typedef int myint;
static myint global_myint;
extern type myint;
extern const global_myint: myint;
// this should enable explicit conversion (cast)
// not implicit conversion
inline operator :(x:myint, type t:int) {
return 1;
}
proc foo(): int {
//return "bla"; // error: can't initialize return value
return global_myint; // expect a similar error
// (compiler shouldn't assume opaque type
// can be implicitly converted to int)
}
writeln(foo());
Associated Future Test(s):
test/extern/ferguson/opaque-type-implicit-conversion.chpl
#19727