mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fixed STB_WEAK errors when using consts in macros in the stdlib #1871.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- Issue where trailing body argument was allowed without type even though the definition specified it #1879.
|
||||
- Fix issues with @jump on empty `default` or only `default` #1893 #1894
|
||||
- Fixes miscompilation of nested `@jump` #1896.
|
||||
- Fixed STB_WEAK errors when using consts in macros in the stdlib #1871.
|
||||
|
||||
### Stdlib changes
|
||||
- Added '%h' and '%H' for printing out binary data in hexadecimal using the formatter.
|
||||
|
||||
@@ -4049,6 +4049,8 @@ bool sema_analyse_var_decl(SemaContext *context, Decl *decl, bool local)
|
||||
is_global = true;
|
||||
break;
|
||||
case VARDECL_CONST:
|
||||
if (local) decl->var.is_static = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
19
test/test_suite/variables/const_in_func.c3t
Normal file
19
test/test_suite/variables/const_in_func.c3t
Normal file
@@ -0,0 +1,19 @@
|
||||
// #target: linux-x64
|
||||
module scratch;
|
||||
import std::test;
|
||||
fn void main()
|
||||
{
|
||||
int x = test::abc();
|
||||
}
|
||||
|
||||
module std::test;
|
||||
|
||||
macro abc()
|
||||
{
|
||||
const int A = 256;
|
||||
return A;
|
||||
}
|
||||
|
||||
/* #expect: scratch.ll
|
||||
|
||||
@main.A = internal local_unnamed_addr constant i32 256, align 4
|
||||
Reference in New Issue
Block a user