[
https://issues.apache.org/jira/browse/AVRO-2081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16258186#comment-16258186
]
Purushotham Nayak commented on AVRO-2081:
-----------------------------------------
Hi Thiru,
Glad you haven't merged this yet.
The patch I submitted fixes the problem with {{c++ (clang)}} but creates a
duplicate definition when using {{g++ (gcc)}}. The reason we didn't see this
problem was because there was no test case that wrote {{vector<bool>}}.
I've update the pull request with new code that optionally defines the
{{codec_traits<vector<bool>::const_reference>}} specialization only if it
doesn't already exist. I've also added a test case to write {{vector<bool>}} so
we can catch if something breaks in the future. I've put all the details into
the commit message for your review. Please let me know if this works and/or if
you think any more changes are needed (e.g. idk if there is a more elegant way
to do this).
> Compilation fails with clang
> ----------------------------
>
> Key: AVRO-2081
> URL: https://issues.apache.org/jira/browse/AVRO-2081
> Project: Avro
> Issue Type: Bug
> Components: c++
> Affects Versions: 1.8.2
> Environment: FreeBSD, clang++ (3.8.0)
> Reporter: Purushotham Nayak
> Assignee: Purushotham Nayak
> Priority: Minor
> Fix For: 1.9.0
>
> Attachments: AVRO-2081.patch
>
>
> Building on {{clang}} fails with the error below. This is because of the
> {{vector<bool>}} specialization. We need a {{codec_traits}} specialization
> for {{vector<bool>::const_reference}}.
> {code}
> avro/lang/c++/api/Specific.hh:321:22: error: no member named 'encode' in
> 'avro::codec_traits<std::__1::__bit_const_reference<std::__1::vector<bool,
> std::__1::allocator<bool> > > >'
> codec_traits<T>::encode(e, t);
> ~~~~~~~~~~~~~~~~~^
> avro/lang/c++/api/Specific.hh:235:23: note: in instantiation of function
> template specialization
> 'avro::encode<std::__1::__bit_const_reference<std::__1::vector<bool,
> std::__1::allocator<bool> > > >' requested here
> avro::encode(e, *it);
> ^
> avro/lang/c++/api/Specific.hh:321:22: note: in instantiation of member
> function 'avro::codec_traits<std::__1::vector<bool, std::__1::allocator<bool>
> > >::encode' requested here
> codec_traits<T>::encode(e, t);
> ^
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)