Merge pull request #10 from reventlov/fix_cxx14
Fix Emboss under C++14
diff --git a/compiler/back_end/cpp/generated_code_templates b/compiler/back_end/cpp/generated_code_templates
index 7ed9198..804544d 100644
--- a/compiler/back_end/cpp/generated_code_templates
+++ b/compiler/back_end/cpp/generated_code_templates
@@ -248,13 +248,13 @@
template <class View>
struct EmbossReservedInternalIsGeneric$_name_$View {
- static constexpr bool value = false;
+ static constexpr const bool value = false;
};
template <class Storage>
struct EmbossReservedInternalIsGeneric$_name_$View<
Generic$_name_$View<Storage>> {
- static constexpr bool value = true;
+ static constexpr const bool value = true;
};
template <typename T>
@@ -544,7 +544,8 @@
}
template <class Storage>
-inline constexpr $_logical_type_$ Generic$_parent_type_$View<
+inline constexpr $_logical_type_$
+Generic$_parent_type_$View<
Storage>::$_virtual_view_type_name_$::UncheckedRead() {
return $_parent_type_$::$_name_$();
}
diff --git a/runtime/cpp/emboss_constant_view.h b/runtime/cpp/emboss_constant_view.h
index 3a60b36..6034c71 100644
--- a/runtime/cpp/emboss_constant_view.h
+++ b/runtime/cpp/emboss_constant_view.h
@@ -39,7 +39,7 @@
constexpr ValueT Read() const { return value_.Value(); }
constexpr ValueT UncheckedRead() const { return value_.ValueOrDefault(); }
- constexpr bool Ok() { return value_.Known(); }
+ constexpr bool Ok() const { return value_.Known(); }
private:
::emboss::support::Maybe<ValueT> value_;
diff --git a/runtime/cpp/test/emboss_memory_util_test.cc b/runtime/cpp/test/emboss_memory_util_test.cc
index 54b8ffe..3cfca8b 100644
--- a/runtime/cpp/test/emboss_memory_util_test.cc
+++ b/runtime/cpp/test/emboss_memory_util_test.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if __cplusplus >= 201402L
+#if __cplusplus >= 201703L
#include <string_view>
-#endif // __cplusplus >= 201402L
+#endif // __cplusplus >= 201703L
#include <vector>
#include "runtime/cpp/emboss_memory_util.h"
@@ -477,12 +477,12 @@
auto str = buffer.ToString</**/ ::std::string>();
EXPECT_TRUE((::std::is_same</**/ ::std::string, decltype(str)>::value));
EXPECT_EQ(str, "abcd");
-#if __cplusplus >= 201402L
+#if __cplusplus >= 201703L
auto str_view = buffer.ToString</**/ ::std::string_view>();
EXPECT_TRUE(
(::std::is_same</**/ ::std::string_view, decltype(str_view)>::value));
EXPECT_EQ(str_view, "abcd");
-#endif // __cplusplus >= 201402L
+#endif // __cplusplus >= 201703L
}
TEST(LittleEndianByteOrderer, Methods) {