Fix Issue 19706 - Attribute inference in struct fails (#15129)

This commit is contained in:
Razvan Nitu 2023-04-26 11:36:53 +03:00 committed by GitHub
parent 8c35e9dd02
commit 7dfafe6dd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View file

@ -1,9 +1,10 @@
module traits_getFunctionAttributes;
alias tuple(T...) = T;
void test_getFunctionAttributes()
{
alias tuple(T...) = T;
struct S
{
@ -118,3 +119,14 @@ void test_getFunctionAttributes()
static assert(__traits(getFunctionAttributes, systemDel) == tuple!("pure", "nothrow", "@nogc", "@system"));
static assert(__traits(getFunctionAttributes, typeof(systemDel)) == tuple!("pure", "nothrow", "@nogc", "@system"));
}
void bug19706()
{
struct S
{
static int fImpl(Ret)() { return Ret.init; }
// tells us: `fImpl!int` is @system
static assert(__traits(getFunctionAttributes, fImpl!int) == tuple!("pure", "nothrow", "@nogc", "@safe"));
}
}