https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92580

--- Comment #1 from Paul Targosz <paultargosz86 at googlemail dot com> ---
//examplecode without godbolt

#include <iostream>
#include <stdint.h>

struct GW_t {

};


template <uint8_t A, uint8_t B, uint8_t C, uint8_t D>
struct IP_t {
    constexpr static uint8_t a = A;
    constexpr static uint8_t b = B;
    constexpr static uint8_t c = C;
    constexpr static uint8_t d = D;
};

template<typename my_config>
void workaround() {
    std::cout << "connecting to static IP " << int{my_config::a} << "." <<
int{my_config::b} << "." << int{my_config::c} << "." << int{my_config::d};
}

int main() {

    // ************* This two lines are the different configurations
     using my_config = GW_t;
    // using my_config = IP_t<192,168,0,8>;



    if constexpr(std::is_same<my_config,GW_t>::value) {
        std::cout << "connecting to Gateway";
    }
    else {
        // ************* first line should work but isn't, second line is the
workaround
         std::cout << "connecting to static IP " << int{my_config::a} << "." <<
int{my_config::b} << "." << int{my_config::c} << "." << int{my_config::d};
        // workaround<my_config>();
    }

    return 0;
}

Reply via email to