You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by aw...@apache.org on 2019/10/02 06:31:40 UTC

[kudu] 02/03: Fix compilation on XCode 11

This is an automated email from the ASF dual-hosted git repository.

awong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit d5447c12c4676c2b176c45ed6a863a1ae9082726
Author: Grant Henke <gr...@apache.org>
AuthorDate: Tue Oct 1 22:39:53 2019 -0500

    Fix compilation on XCode 11
    
    I recently upgraded my Mac to XCode 11 which now fails with:
    
    …/kudu/src/kudu/consensus/quorum_util-test.cc:49:16: error: constexpr variable cannot have non-literal type 'const std::initializer_list<char>'
    constexpr auto kHealthStatuses = { '?', '-', 'x', '+' };
                   ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/initializer_list:59:28: note: 'initializer_list<char>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors
    class _LIBCPP_TEMPLATE_VIS initializer_list
    
    This looks to be realted some ambiquity in compiler support for this syntax:
    https://stackoverflow.com/questions/36863503/struct-is-non-literal-type/36863691
    
    I fixed this by converting it to a const instead of a consexpr.
    
    Change-Id: Iad3db5ac4d65fd9bdfa8f357b350f24d0e0d3ec0
    Reviewed-on: http://gerrit.cloudera.org:8080/14343
    Tested-by: Kudu Jenkins
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
 src/kudu/consensus/quorum_util-test.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kudu/consensus/quorum_util-test.cc b/src/kudu/consensus/quorum_util-test.cc
index a0b3851..b4d5f65 100644
--- a/src/kudu/consensus/quorum_util-test.cc
+++ b/src/kudu/consensus/quorum_util-test.cc
@@ -46,7 +46,7 @@ constexpr auto U = RaftPeerPB::UNKNOWN_MEMBER_TYPE; // NOLINT(readability-identi
 constexpr auto V = RaftPeerPB::VOTER;               // NOLINT(readability-identifier-naming)
 
 // The various possible health statuses.
-constexpr auto kHealthStatuses = { '?', '-', 'x', '+' };
+const auto kHealthStatuses = { '?', '-', 'x', '+' };
 
 typedef std::pair<string, bool> Attr;