Skip to content

Commit

Permalink
Merge pull request #819 from ReneZwanenburg/isRWField-alias-fix
Browse files Browse the repository at this point in the history
Detect type aliases in isRWField. Fixes #818.
  • Loading branch information
s-ludwig committed Sep 11, 2014
2 parents f44f56b + 92b600f commit f02492c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/vibe/internal/meta/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ template isRWField(T, string M)
__traits(getMember, *pt, M) = __traits(getMember, *pt, M);
}

// reject type aliases
static if (is(TypeTuple!(__traits(getMember, T, M)))) enum isRWField = false;
// reject non-public members
static if (!isPublicMember!(T, M)) enum isRWField = false;
else static if (!isPublicMember!(T, M)) enum isRWField = false;
// reject static members
else static if (!isNonStaticMember!(T, M)) enum isRWField = false;
// reject non-typed members
Expand All @@ -173,6 +175,7 @@ unittest {
import std.algorithm;

struct S {
alias a = int; // alias
int i; // plain RW field
enum j = 42; // manifest constant
static int k = 42; // static field
Expand Down

0 comments on commit f02492c

Please sign in to comment.