mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00

Resolves #15335: getSymbolsByUDA fails if type has private members. Generous (ab)use of mixins allows getSymbolsByUDA to reference symbols without trying to access them, allowing it to inspect private members without failing. Testing this required private symbols defined outside of std.traits. This adds std.internal.test.uda, which defines a struct containing private members that is used in a unittest added to std.traits.
16 lines
273 B
D
16 lines
273 B
D
/**
|
|
For testing only.
|
|
Provides a struct with UDA's defined in an external module.
|
|
Useful for validating behavior with member privacy.
|
|
*/
|
|
module std.internal.test.uda;
|
|
|
|
enum Attr;
|
|
|
|
struct HasPrivateMembers
|
|
{
|
|
@Attr int a;
|
|
int b;
|
|
@Attr private int c;
|
|
private int d;
|
|
}
|