Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing stdint.h type through two defines loses builtin #87

Open
TotallyGamerJet opened this issue Feb 13, 2025 · 0 comments
Open

Passing stdint.h type through two defines loses builtin #87

TotallyGamerJet opened this issue Feb 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@TotallyGamerJet
Copy link
Contributor

TotallyGamerJet commented Feb 13, 2025

Given the following code:

#include <stdint.h>

#define ARRAY_DEFINE_FUNCTIONS(typeName)  \
typeName typeName##_DEFAULT = {0};               \
void Get() {                                    \
    (void)&typeName##_DEFAULT;                 \
}                                               \

#define ARRAY_DEFINE(typeName)     \
ARRAY_DEFINE_FUNCTIONS(typeName)   \

ARRAY_DEFINE(uint32_t)

I get the following error:

clay.h: parsing failed: clay.h:12:1: `unsigned`: expected primary-expression

I traced the error to builtin.h. For some reason it loses the information about it being a builtin when passed through two defines.

Expected output:

var int_DEFAULT uint32 = uint32{}

func Get() {
	_ = &int_DEFAULT
}
@dennwc dennwc added the bug Something isn't working label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants