Skip to content

ambiguous fvar template instantiation of ad_promotable with g++ 5.4.0 #528

Closed

Description

@bbbales2

Summary:

The unit tests are failing with g++ 5.4.0

Description:

I'm not sure what's happening, honestly. I'm not familiar with the code that is breaking. This just came up when trying to merge some new code into Stan. (see http://discourse.mc-stan.org/t/stans-runtests-py-src-test-unit-failing-with-g-works-with-clang/351, stan-dev/stan#2285)

Reproducible Steps:

In Ubuntu 16.04 with g++ 5.4.0 (the default compiler)

make test/unit/math/mix/mat/prob/categorical_test (in the math repo)

Should fail

Current Output:

https://gist.github.com/bbbales2/0a2456d516bbe1200a4d1ee76b936656

Expected Output:

The tests to pass

Additional Information:

I had a dig around. I'm not sure what I'm doing (so don't interpret this as an actual fix), but this change seems to get rid of the error:
bbbales2@52de78f

It seemed like the compiler couldn't decide between using:

template <typename T>
    struct ad_promotable<T, T> {
      enum { value = true };
    };

with T = stan::math::fvarstan::math::var

and

template <typename V, typename T>
    struct ad_promotable<V, fvar<T> > {
      enum { value = ad_promotable<V, T>::value };
    };

with V = stan::math::fvarstan::math::var, T = double

So I just made a type to specifically absorb two fvars. Maybe this is helpful in figuring out the problem. Again I'm not sure what I'm doing so don't interpret this as a fix.

Current Version:

v2.15.0

Activity

  1. changed the title [-]Math unit tests failing with g++ 5.4.0[/-] [+]ambiguous fvar template instantiation with g++ 5.4.0[/+] on Apr 24, 2017
  2. added this to the milestone on Apr 24, 2017
  3. bob-carpenter commented on Apr 24, 2017

    @bob-carpenter
    Member

    I'll take this one. Should be fast, as in a few hours.

  4. changed the title [-]ambiguous fvar template instantiation with g++ 5.4.0[/-] [+]ambiguous fvar template instantiation of ad_promotable with g++ 5.4.0[/+] on Apr 24, 2017
  5. bob-carpenter commented on Apr 24, 2017

    @bob-carpenter
    Member

    Also note that edited out mixed mode tests in stan-dev/math/.travis.yml

  6. added a commit that references this issue on Apr 25, 2017
    7a36f88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions