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

pragma(msg, BasicType TypeSuffix) doesn't parse #18271

Open
dlangBugzillaToGithub opened this issue Oct 4, 2024 · 3 comments
Open

pragma(msg, BasicType TypeSuffix) doesn't parse #18271

dlangBugzillaToGithub opened this issue Oct 4, 2024 · 3 comments

Comments

@dlangBugzillaToGithub
Copy link

Manu reported this on 2024-10-04T04:50:09Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24791

CC List

Description

I feel like this should work:

int x; 
pragma(msg, typeof(x)*);

error : expression expected, not `)`

It should print `int*`
@dlangBugzillaToGithub
Copy link
Author

nick (@ntrel) commented on 2024-10-05T16:55:34Z

The argument must be an AssignExpression. 
https://dlang.org/spec/pragma.html#msg

There is no postfix `*` operator, so it fails to parse.

@dlangBugzillaToGithub
Copy link
Author

turkeyman commented on 2024-10-11T08:53:27Z

I don't really care for reasons; this is an obvious bug:

pragma(msg, int);  // > int
pragma(msg, int*); // > int*

alias X = int;
pragma(msg, X);    // > int
pragma(msg, X*);   // error!


Edge cases like this just randomly break meta-programming.
We especially depend on pragma(msg) to understand and debug meta-programming.

@thewilsonator thewilsonator removed OS:Windows Arch:x86 Issues specific to x86 P1 labels Dec 14, 2024
@ntrel
Copy link
Contributor

ntrel commented Dec 30, 2024

pragma(msg, int); // > int

That works since #14672.

See also dlang/dlang.org#4155.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants