mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
workaround for C++ 98 const union problem.
Not the case of recent compilers, but compilers before C++11
rejected ruby.h, like 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.
This commit is contained in:
parent
042c436cd9
commit
150f514e19
Notes:
git
2019-09-09 21:28:05 +09:00
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue