File tree 2 files changed +13
-12
lines changed
2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -2069,17 +2069,16 @@ IntVal* SemanticsVisitor::tryConstantFoldExpr(
2069
2069
if (!isValidCompileTimeConstantType (substType))
2070
2070
return nullptr ;
2071
2071
2072
- IntVal* val = nullptr ;
2073
- if (auto floatLitExpr = typeCastOperand. as <FloatingPointLiteralExpr>() )
2072
+ IntVal* val = tryConstantFoldExpr (typeCastOperand, kind, circularityInfo) ;
2073
+ if (!val )
2074
2074
{
2075
- // When explicitly casting from float type to integer type, let's fold it as an integer
2076
- // value.
2077
- const IntegerLiteralValue value = IntegerLiteralValue (floatLitExpr.getExpr ()->value );
2078
- val = m_astBuilder->getIntVal (substType, value);
2079
- }
2080
- else
2081
- {
2082
- val = tryConstantFoldExpr (typeCastOperand, kind, circularityInfo);
2075
+ if (auto floatLitExpr = typeCastOperand.as <FloatingPointLiteralExpr>())
2076
+ {
2077
+ // When explicitly casting from float type to integer type, let's fold it as
2078
+ // an integer value.
2079
+ const IntegerLiteralValue value = IntegerLiteralValue (floatLitExpr.getExpr ()->value );
2080
+ val = m_astBuilder->getIntVal (substType, value);
2081
+ }
2083
2082
}
2084
2083
2085
2084
if (val)
Original file line number Diff line number Diff line change 2
2
3
3
// Tests reflection of user defined attributes.
4
4
5
- // DIAGNOSTIC_TEST: REFLECTION:-stage compute -entry main -target hlsl
5
+ // TEST:SIMPLE(filecheck= REFLECTION) :-stage compute -entry main -target hlsl
6
6
7
7
[__AttributeUsage(_AttributeTargets .Struct )]
8
8
struct MyStructAttribute
@@ -16,9 +16,11 @@ struct DefaultValueAttribute
16
16
int iParam;
17
17
};
18
18
19
+ // REFLECTION:([[# @LINE+1]]): error 30019: expected an expression of type 'float', got 'String'
19
20
[MyStruct(0 , " stringVal" )] // attribute arg type mismatch
20
21
struct A
21
22
{
23
+ // REFLECTION:([[# @LINE+1]]): error 31002: attribute 'MyStruct' is not valid here
22
24
[MyStruct(0 , 10 . 0 )] // attribute does not apply to this construct
23
25
float x;
24
26
[DefaultValue(2 . 0 )] // attribute arg type mismatch
@@ -31,4 +33,4 @@ ParameterBlock<A> param;
31
33
void main(
32
34
uint3 dispatchThreadID : SV_DispatchThreadID)
33
35
{
34
- }
36
+ }
You can’t perform that action at this time.
0 commit comments