http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52706

             Bug #: 52706
           Summary: [C++11] Demangling of templates with std::nullptr_t as
                    non-type parameter
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com


gcc 4.8.0 20120318 (experimental) has problems to correctly demangle templates
with a non-type template parameter of std::nullptr_t. The following example:

//---
template<class T>
struct W {
  template<class U,
    decltype(nullptr) = nullptr
    //bool = false // OK
  >
  W(U&&);
};

template<class T, decltype(nullptr) = nullptr>
int f(T);

W<int> w1 = 0;
W<int*> w2 = nullptr; // 14

int i1 = f(0);
int i2 = f(nullptr); // 17
//---

produces link error messages as follows:

"13|undefined reference to `W<int>::W<int, (decltype(nullptr))0>(int&&)'
14|undefined reference to `_ZN1WIPiEC1IDnLS3_0EEEOT_'|
16|undefined reference to `int f<int, (decltype(nullptr))0>(int)'|
17|undefined reference to `_Z1fIDnLS0_0EEiT_'"

The problem seems to occur, if there is at least one further template
parameter, because

template<decltype(nullptr) = nullptr>
int g();

int i3 = g();

correctly produces:

"undefined reference to `int g<(decltype(nullptr))0>()'"

Reply via email to