From ebe97f3ce19b1856dd8785179f1a37c7e5bf8e57 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 27 Oct 2020 18:47:39 +0000 Subject: [PATCH] Fix build for tests on gcc-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ../src/inspector/inspector_test.cc [build] ../src/inspector/inspector_test.cc:203:13: error: explicit specialization in non-namespace scope ‘class tint::inspector::{anonymous}::InspectorHelper’ [build] 203 | template <> [build] | ^ [build] ../src/inspector/inspector_test.cc:205:60: error: template-id ‘MakeLiteral’ in declaration of primary template [build] 205 | bool* val) ``` These `MakeLiteral()` methods can just be standard non-templated overloads - so do that. Change-Id: I7e0b4ec10636eaf772d1ed4d3e9341c5da4087af Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31120 Commit-Queue: Ben Clayton Commit-Queue: dan sinclair Reviewed-by: dan sinclair --- src/inspector/inspector_test.cc | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc index 91e69800da..dbdaf934f8 100644 --- a/src/inspector/inspector_test.cc +++ b/src/inspector/inspector_test.cc @@ -184,52 +184,38 @@ class InspectorHelper { dvar->set_decorations(std::move(decos)); if (val) { dvar->set_constructor(std::make_unique( - MakeLiteral(type, val))); + MakeLiteral(type, val))); } mod()->AddGlobalVariable(std::move(dvar)); } - /// Generates an ast::Literal for the given value - /// @tparam T C++ type of the literal, must agree with type - /// @returns a Literal of the expected type and value - template - std::unique_ptr MakeLiteral(ast::type::Type*, T*) { - return nullptr; - } - /// @param type AST type of the literal, must resolve to BoolLiteral /// @param val scalar value for the literal to contain /// @returns a Literal of the expected type and value - template <> - std::unique_ptr MakeLiteral(ast::type::Type* type, - bool* val) { + std::unique_ptr MakeLiteral(ast::type::Type* type, bool* val) { return std::make_unique(type, *val); } /// @param type AST type of the literal, must resolve to UIntLiteral /// @param val scalar value for the literal to contain /// @returns a Literal of the expected type and value - template <> - std::unique_ptr MakeLiteral(ast::type::Type* type, - uint32_t* val) { + std::unique_ptr MakeLiteral(ast::type::Type* type, + uint32_t* val) { return std::make_unique(type, *val); } /// @param type AST type of the literal, must resolve to IntLiteral /// @param val scalar value for the literal to contain /// @returns a Literal of the expected type and value - template <> - std::unique_ptr MakeLiteral(ast::type::Type* type, - int32_t* val) { + std::unique_ptr MakeLiteral(ast::type::Type* type, + int32_t* val) { return std::make_unique(type, *val); } /// @param type AST type of the literal, must resolve to FloattLiteral /// @param val scalar value for the literal to contain /// @returns a Literal of the expected type and value - template <> - std::unique_ptr MakeLiteral(ast::type::Type* type, - float* val) { + std::unique_ptr MakeLiteral(ast::type::Type* type, float* val) { return std::make_unique(type, *val); }