mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Incorrect visibility on local globals with public aliases. #2519
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
- Bitstruct truncated constant error escapes `$defined` #2515.
|
||||
- Compiler segfault when accessing member of number cast to bitstruct #2516.
|
||||
- Compiler assert when getting a member of a `bitstruct : char @bigendian` #2517.
|
||||
- Incorrect visibility on local globals with public aliases. #2519
|
||||
|
||||
### Stdlib changes
|
||||
|
||||
|
||||
@@ -5302,6 +5302,10 @@ static inline bool sema_analyse_alias(SemaContext *context, Decl *decl, bool *er
|
||||
}
|
||||
decl->type = symbol->type;
|
||||
decl->define_decl.alias = symbol;
|
||||
if (decl_is_externally_visible(decl) && !decl_is_externally_visible(symbol))
|
||||
{
|
||||
symbol->is_external_visible = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
20
test/test_suite/define/alias_visibility.c3t
Normal file
20
test/test_suite/define/alias_visibility.c3t
Normal file
@@ -0,0 +1,20 @@
|
||||
// #target: macos-x64
|
||||
module test1;
|
||||
alias x = y;
|
||||
int y @local = 1;
|
||||
|
||||
module test;
|
||||
import test1;
|
||||
|
||||
fn int main(String[] args)
|
||||
{
|
||||
return test1::x;
|
||||
}
|
||||
|
||||
/* #expect: test1.ll
|
||||
|
||||
@test1.y.10 = local_unnamed_addr global i32 1, align 4
|
||||
|
||||
// #expect: test.ll
|
||||
|
||||
@test1.y.10 = external global i32, align 4
|
||||
Reference in New Issue
Block a user