1cb93a386Sopenharmony_ciuniform float u; 2cb93a386Sopenharmony_ci 3cb93a386Sopenharmony_ciconst float c = 1; 4cb93a386Sopenharmony_ci float f = 1; 5cb93a386Sopenharmony_ci 6cb93a386Sopenharmony_cistruct S { float f; } s; 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci// Valid constant-expression initializers. Should not produce errors: 9cb93a386Sopenharmony_civoid from_literal() { const float x = 0; } 10cb93a386Sopenharmony_civoid from_const_global() { const float x = c; } 11cb93a386Sopenharmony_civoid from_const_local() { const float x = 0; const float y = x; } 12cb93a386Sopenharmony_civoid from_const_constructor() { const int i = int(c); } 13cb93a386Sopenharmony_civoid from_expression() { const float x = 2 * c; } 14cb93a386Sopenharmony_ci 15cb93a386Sopenharmony_ci// Invalid constant-expression initializers. Should all produce errors: 16cb93a386Sopenharmony_civoid from_uniform() { const float x = u; } 17cb93a386Sopenharmony_civoid from_parameter(float p) { const float x = p; } 18cb93a386Sopenharmony_civoid from_const_parameter(const float p) { const float x = p; } 19cb93a386Sopenharmony_civoid from_non_const_local() { float x = u; const float y = x; } 20cb93a386Sopenharmony_civoid from_non_const_expression() { const float x = u + u; } 21cb93a386Sopenharmony_civoid from_mixed_expression() { const float x = c + u; } 22cb93a386Sopenharmony_civoid from_non_const_struct_field() { const float x = s.f; } 23