@@ -8840,9 +8840,9 @@ template getSymbolsByUDA(alias symbol, alias attribute)
88408840 static assert (is (getSymbolsByUDA! (X, X) == AliasSeq! ()));
88418841}
88428842
8843- // https://issues.dlang.org/show_bug.cgi?id=23776
88448843@safe pure nothrow @nogc unittest
88458844{
8845+ // https://issues.dlang.org/show_bug.cgi?id=23776
88468846 struct T
88478847 {
88488848 struct Tag {}
@@ -8862,6 +8862,18 @@ template getSymbolsByUDA(alias symbol, alias attribute)
88628862 }
88638863 alias xcomponents = getSymbolsByUDA! (X, X.Tag);
88648864 static assert (xcomponents.length > 0 );
8865+
8866+ // https://issues.dlang.org/show_bug.cgi?id=23977
8867+ struct S (string str)
8868+ {
8869+ alias strstr = str;
8870+
8871+ int i;
8872+ }
8873+
8874+ static struct A {}
8875+
8876+ assert ((getSymbolsByUDA! (S! (" a" ), A)).length == 0 );
88658877}
88668878
88678879// getSymbolsByUDA produces wrong result if one of the symbols having the UDA is a function
@@ -8919,7 +8931,10 @@ private template getSymbolsByUDAImpl(alias symbol, alias attribute, names...)
89198931
89208932 // Filtering not compiled members such as alias of basic types.
89218933 static if (isAliasSeq! member ||
8922- (isType! member && ! isAggregateType! member && ! is (member == enum )))
8934+ // exclude basic types and derived types
8935+ (isType! member && ! isAggregateType! member && ! is (member == enum )) ||
8936+ // exclude aliases to expressions such as string literals
8937+ __traits (compiles , { auto ex = member; }))
89238938 {
89248939 alias getSymbolsByUDAImpl = tail;
89258940 }
0 commit comments