mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Disambiguate types when they have the same name and need cast between each other.
This commit is contained in:
15
test/test_suite/cast/implicit_cast_same_name.c3
Normal file
15
test/test_suite/cast/implicit_cast_same_name.c3
Normal file
@@ -0,0 +1,15 @@
|
||||
module foo::a;
|
||||
struct Lexer { int a; }
|
||||
fn void foo(Lexer *lex) {}
|
||||
|
||||
module foo::b;
|
||||
struct Lexer { int a; }
|
||||
fn void foo(Lexer *lex) {}
|
||||
|
||||
module foo;
|
||||
|
||||
fn void bar()
|
||||
{
|
||||
a::Lexer l;
|
||||
b::foo(&l); // #error: Implicitly casting 'foo::a::Lexer*' to 'foo::b::Lexer*' is not permitted, but you may do an explicit cast by placing '(foo::b::Lexer*)' before the expression
|
||||
}
|
||||
Reference in New Issue
Block a user