diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-09-09 11:13:31 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-09-09 21:27:40 +0900 |
commit | 150f514e19125ce8239602dc9266c7f68166d671 (patch) | |
tree | 7b67378a97f1106d921cac68c91a2ef1d235a03a /include/ruby | |
parent | 042c436cd9cfaeee7a0d7b8e35bee8dec90e972d (diff) | |
download | ruby-150f514e19125ce8239602dc9266c7f68166d671.tar.gz |
workaround for C++ 98 const union problem.
Not the case of recent compilers, but compilers before C++11
rejected ruby.h, like https://ci.appveyor.com/project/ruby/ruby/builds/27225706/job/qjca7dpe204dytbd
This is supposedly because a struct with a member qualified with
a const effectively deletes its default copy constructor, which
is considered as being user-defined somehow. Not sure where
exactly is the phrase in the C++98 standard who allows such C /
C++ incompatibility though.
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/ruby.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 445b2cd4d3..0bede6ffdd 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1054,7 +1054,12 @@ struct RArray { long len; union { long capa; - const VALUE shared_root; +#if defined(__clang__) /* <- clang++ is sane */ || \ + !defined(__cplusplus) /* <- C99 is sane */ || \ + (__cplusplus > 199711L) /* <- C++11 is sane */ + const +#endif + VALUE shared_root; } aux; const VALUE *ptr; } heap; |