Skip to main content

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



I think the problem origins from the fact that getID() is a constexpr function. If I replace "A::getID()" in the template argument of B with the corresponding part of its return statement "static_cast<uint16_t>(TEST_ID)" the problem vanishes. Therefore, it would be related to this bug:

I'm not sure whether your case should already be working or not.







From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of scalpel4k
Sent: Freitag, 5. Juli 2013 12:00
To: CDT General developers list.
Subject: [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