-
-
Notifications
You must be signed in to change notification settings - Fork 653
[WIP] Resolve TypeInfo variables after semantic #4654
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
Conversation
d5cb9c6
to
b7fe25d
Compare
Great idea, thanks! I'll update D-Programming-GDC/gdc#100 later today.
Can you give an example why/how this is necessary? Minimal runtimes right now implement TypeInfo as empty classes. For this to work we really need valid, full TypeInfo declarations. It could also be kinda strange if code like this doesn't work: static if(is(typeof(typeid(a).name)))
{
auto b = typeid(a).name;
} |
Ok, I guess it's more that there's existing code in druntime that depends on finding the members, so the type must be valid if it's used. Otherwise you'll get 'declaration not found' errors instead of 'cannot use typeinfo' errors. Maybe this is acceptable. |
Yes I think that's acceptable. Looks like we don't have to do anything special about this: If the runtime doesn't provide the declarations and somebody uses |
f1421bf
to
31d665c
Compare
Passing now. |
@@ -32,6 +32,7 @@ | |||
#include "ctfe.h" | |||
#include "arraytypes.h" | |||
#include "visitor.h" | |||
#include "template.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for isType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks.
Resolve TypeInfo variables after semantic
this caused regression 1418: |
Only resolve the type during semantic, and leave all expressions as
typeid(xxx)
. Theoretically this should allow a clean way to ban access to typeinfo at runtime, while still allowing usage during ctfe.@jpf91