Parse UDAs like template arguments (#14881)

This commit is contained in:
Dennis 2023-03-30 07:23:45 +02:00 committed by GitHub
parent d98f586771
commit ef1bca90e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 93 additions and 14 deletions

View file

@ -0,0 +1,22 @@
enum Test;
@true @null @byte int x;
@(int) int y;
@"test" @`test2` @30 @'a' @__LINE__ void f();
@Test void h();
static assert( __traits(getAttributes, x)[0] == true);
static assert( __traits(getAttributes, x)[1] == null);
static assert(is(__traits(getAttributes, x)[2] == byte));
static assert(is(__traits(getAttributes, y)[0] == int));
static assert( __traits(getAttributes, f)[0] == "test");
static assert( __traits(getAttributes, f)[1] == "test2");
static assert( __traits(getAttributes, f)[2] == 30);
static assert( __traits(getAttributes, f)[3] == 'a');
static assert( __traits(getAttributes, f)[4] == 6);
static assert(is(__traits(getAttributes, h)[0] == enum));