Delphi attributes and ordinal (simple) types

The custom attributes don't work with ordinal (simple) types in Delphi including last version XE 10.

program Project2;
 
{$APPTYPE CONSOLE}
 
uses
  RTTI;
 
type
  [MaxLengthAttribute(100)]
  TTestType = type string;
 
var
  LContext: TRttiContext;
  AType: TRttiType;
  Attrs: TArray<TCustomAttribute>;
  Attr: TCustomAttribute;
begin
  LContext := TRttiContext.Create;
  AType := LContext.GetType(TypeInfo(TTestType));
  Writeln(AType.ToString);
  Attrs := AType.GetAttributes();
  for Attr in Attrs do
    Writeln(Attr.ClassName);
  LContext.Free;
end.

This code is compiled but GetAttributes returns an empty array. In the documentation I cannot find any constraints but it doesn't work...

There is no workaround, you can only define attributes directly for properties of this type:

TTestType = type string;
...
class TMyClass
  [MaxLengthAttribute(100)]
  property MyProp: TTestType... 
end;