diff --git a/src/sksl/SkSLASTNode.h b/src/sksl/SkSLASTNode.h index e6d3015d33..d95b43a778 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. @@ -251,7 +263,7 @@ struct ASTNode { }; struct NodeData { - char fBytes[std::max({sizeof(Token::Kind), + char fBytes[skia_max({sizeof(Token::Kind), sizeof(StringFragment), sizeof(bool), sizeof(SKSL_INT),