diff --git a/src/sksl/SkSLASTNode.h b/src/sksl/SkSLASTNode.h index f266e75493..84a958411d 100644 --- a/src/sksl/SkSLASTNode.h +++ b/src/sksl/SkSLASTNode.h @@ -18,6 +18,18 @@ namespace SkSL { +namespace { +template +constexpr T skia_max( std::initializer_list list ) +{ +T max = *list.begin(); +for(auto i: list) + if( max < i ) + max = i; +return max; +} +} + /** * Represents a node in the abstract syntax tree (AST). The AST is based directly on the parse tree; * it is a parsed-but-not-yet-analyzed version of the program. @@ -233,7 +245,7 @@ struct ASTNode { // We use fBytes as a union which can hold any type of AST node, and use placement-new to // copy AST objects into fBytes. Note that none of the AST objects have interesting // destructors, so we do not bother doing a placement-delete on any of them in ~NodeData. - char fBytes[std::max({sizeof(Operator), + char fBytes[skia_max({sizeof(Operator), sizeof(skstd::string_view), sizeof(bool), sizeof(SKSL_INT),