[LLVMbugs] [Bug 13702] New: Static constexpr methods of template aliases do not get instantiated

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Aug 26 17:08:40 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13702

             Bug #: 13702
           Summary: Static constexpr methods of template aliases do not
                    get instantiated
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: arcata at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code fails with an "implicit instantiation of undefined template
'd<a<std::__1::array<int, 1> >, void>'" error:

```
#include <array>
#include <type_traits>

template<typename T>
struct a { static constexpr bool value() { return true; } };

template<int N>
struct b { using type = std::array<int, N>; };

template<int N>
using c = a<typename b<N>::type>;

template<typename T, typename If = void>
struct d;

template<typename T>
struct d<T, typename std::enable_if<T::value()>::type>
{
    static constexpr int value = 42;
};

//static_assert(a<std::array<int,1>>::value(), "");

static_assert(d<c<1>>::value == 42, "");

int main() {}
```

There appears to be an improper substitution failure in the enable_if
expression for the `d` specialization when an instance of `a` is first
referenced through the template alias `c`. Uncommenting the first static_assert
expression, which causes `a` to be instantiated directly before being used
through the template alias, causes the program to compile successfully.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list