boostorg / boostorg/accumulators

compile error when combining headers

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
26
Forks
61
PR merge metrics
No merged PRs in 30d

Description

I am using 1_66. I have two header files in two different libraries which work fine on their own, but when including both headers at once I get a compile error (with clang and msvc). A small example is given by the following code

test.cpp:
```
// first header file

#include
#include
#include

/* ... */

typedef boost::accumulators::accumulator_set<
double, boost::accumulators::stats, double>
accumulator_set;
accumulator_set acc_;

/* ... */

// second header file

#include

/* ... */
```
Compiling this code with `clang++ -c test.cpp` yields

```
In file included from test.cpp:18:
In file included from /usr/local/include/boost/accumulators/statistics.hpp:19:
/usr/local/include/boost/accumulators/statistics/kurtosis.hpp:105:8: error: explicit specialization of 'boost::accumulators::feature_of' after instantiation
struct feature_of
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/accumulators/framework/depends_on.hpp:284:30: note: implicit instantiation first required here
typename feature_of::type
^
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the minimal test.cpp example and compile it using clang++ -c test.cpp, then inspect boost/accumulators/statistics.hpp, statistics/kurtosis.hpp, and framework/depends_on.hpp around the reported lines. Done means the two header sets can be included together without the explicit-specialization-after-instantiation error on clang and MSVC.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.