]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw_file.h: Clang has a more rigid requirement for definition.
authorWillem Jan Withagen <wjw@digiware.nl>
Tue, 17 May 2016 17:48:37 +0000 (19:48 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Wed, 25 May 2016 10:13:00 +0000 (12:13 +0200)
commit4e0c668d4eb388357c59d1467c353e44146d1c7f
tree89c15a4ca8cf8557dbb2bb720be1582459e08e15
parent54400e8f8945b877bcb1844cde023bffedf897c9
rgw_file.h: Clang has a more rigid requirement for definition.

 The ODR-used in [1] indicates that ODR-used does not result in the
 definition of the variable...

The definition is:
class class RGWFileHandle {
  static constexpr uint32_t FLAG_NONE =    0x0000;
}

And in this case, quoted from: Chefu Chai:
  because the constructor of std::tuple<> always passes its
  parameters by reference if possible and the values of its
  parameters are evaluated, RGWFileHandle::FLAG_NONE is ODR-used[1].
  but RGWFileHandle::FLAG_NONE out side of the class is not found
  anywhere. this fails the linker. so we should convert this lvalue
  to rvalue manually: uint32_t(RGWFileHandle::FLAG_NONE) when
  passing it to the ctor.

So the transformation to a rvalue allow of const evaluation, and thus
a definition of the varaible is no longer needed.

Otherwise without the cast this will result, during linking, in:
./.libs/librgw.so: undefined reference to `rgw::RGWFileHandle::FLAG_NONE'
clang++: error: linker command failed with exit code 1

 "[1] http://en.cppreference.com/w/cpp/language/definition"

Reviewed-by: kefu Chai <tchaikov@gmail.com>
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/rgw/rgw_file.h