GithubHelp home page GithubHelp logo

Comments (2)

alifahrri avatar alifahrri commented on May 26, 2024

error message: https://github.com/alifahrri/nmtools/actions/runs/3811800301/jobs/6484666756

/work/tests/array/index/reshape.cpp:639:5: error: constexpr variable 'result' must be initialized by a constant expression
    CONSTEXPR_SHAPE_RESHAPE_SUBCASE( case5, shape, newshape_ct );
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/work/tests/array/index/reshape.cpp:377:20: note: expanded from macro 'CONSTEXPR_SHAPE_RESHAPE_SUBCASE'
    constexpr auto result = RUN_impl(__VA_ARGS__); \
                   ^        ~~~~~~~~~~~~~~~~~~~~~
/work/include/nmtools/array/index/reshape.hpp:21:30: note: read of variable whose lifetime has ended
            const auto d_i = at(dst_shape,i);
                             ^
/work/include/nmtools/array/index/reshape.hpp:77:53: note: in call to 'count_negative_reshape(newshape_ct)'
            const auto [minus_1_count, dst_numel] = count_negative_reshape(dst_shape);
                                                    ^

related code: https://github.com/alifahrri/nmtools/blob/clang-compile-error-constexpr-variable-lifetime-2/include/nmtools/array/index/reshape.hpp#L21

    template <typename dst_shape_t>
    constexpr auto count_negative_reshape(const dst_shape_t& dst_shape)
    {
        auto minus_1_count = 0;
        auto dst_numel = (size_t)0;
        using index_t = meta::get_index_element_type_t<dst_shape_t>;
        for (size_t i=0; i<len(dst_shape); i++) {
            const auto d_i = at(dst_shape,i);
            if (i==0) {
                dst_numel = 1;
            }

works just fine on gcc: https://github.com/alifahrri/nmtools/actions/runs/3811800303/jobs/6484666704

from nmtools.

alifahrri avatar alifahrri commented on May 26, 2024

fixed in #216

from nmtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.