Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] resolution error

Hi guys,

 

I am facing a little problem using templates. The following code example produces a symbol resolution error message while the compiler itself does not choke at all.

I tend to say that I don't need the explicit static_cast in class C, so is this a bug which I should report?

 

#include <stdint.h>

 

#define TEST_ID 0

 

struct A {

 

static constexpr uint16_t getID() {

return static_cast<uint16_t>(TEST_ID);

}

 

};

 

template<uint16_t ID>

struct B {

 

static constexpr uint16_t getID() {

return ID;

}

 

};

 

struct C {

 

static uint16_t getID_0 () {

return B<static_cast<uint16_t>(A::getID())>::getID(); // why do I

}

 

static uint16_t getID_1 () {

return B<A::getID()>::getID(); // resolution error

}

 

};


Back to the top