From 64786ec12a6e648bf64d2e7e76772cf0d2029487 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 16 May 2017 07:20:47 +0200 Subject: [PATCH] Main: omit "constexpr" on MIN_BUFFER_SIZE with GCC 4.x --- NEWS | 1 + src/Main.cxx | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c4aefd52d..f3bc7a04f 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.20.8 (not yet released) * output - osx: fix build failure due to missing "noexcept" +* fix build failure with GCC 4.x ver 0.20.7 (2017/05/15) * database diff --git a/src/Main.cxx b/src/Main.cxx index a431aa4ec..e05afe633 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -121,8 +121,16 @@ static constexpr size_t KILOBYTE = 1024; static constexpr size_t MEGABYTE = 1024 * KILOBYTE; static constexpr size_t DEFAULT_BUFFER_SIZE = 4 * MEGABYTE; -static constexpr size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32, - 64 * KILOBYTE); + +static +#if GCC_OLDER_THAN(5,0) +/* gcc 4.x has no "constexpr" for std::max() */ +const +#else +constexpr +#endif +size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32, + 64 * KILOBYTE); static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;