-
-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Summary:
From @jpritikin on the stan-dev group in response to a query about header include order causing problems:
Is there a way to catch this kind of thing with the C preprocessor? For example, a trait could #define I_AM_A_TRAIT
and then if some other header got included later in the wrong order then you could #error
.
Description:
We run into order dependencies in our header includes, primarily for traits. For example, we often require the Eigen version of a recursive template trait metaprogram to be included before the standard vector version in order ot handle arrays of matrices. We'd like to be able to catch wrong include orders at build time rather than getting perplexing errors.
Reproducible Steps:
A concrete example is including stan/math/prim/arr.hpp
before stan/math/prim/mat.hpp
.
Current Output:
Compliation failure.
Expected Output:
Prepropcoessor error with informative error message.
Current Version:
v2.11.0