[LLVMbugs] [Bug 12647] New: Substitution failure is an error with alias templates

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 24 18:22:20 PDT 2012


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

             Bug #: 12647
           Summary: Substitution failure is an error with alias templates
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rmf at spamherelots.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Consider the following program:

#include <type_traits>
#include <iostream>

template <typename T>
using EnableIf = typename std::enable_if<T::value>::type;
template <typename T>
using DisableIf = typename std::enable_if<!T::value>::type;

template <typename T>
EnableIf<std::is_enum<T>> f() { std::cout << "foo"; }

template <typename T>
DisableIf<std::is_enum<T>> f() { std::cout << "bar"; }

int main() {
    f<int>();
}

Clang produces the following error messages:

test.c++:7:1: fatal error: no type named 'type' in 'std::__1::enable_if<false,
void>'
using DisableIf = typename std::enable_if<!T::value>::type;
^~~~~
test.c++:13:1: note: in instantiation of template type alias 'DisableIf'
requested here
DisableIf<std::is_enum<T>> f() { std::cout << "bar"; }
^
test.c++:13:28: note: while substituting explicitly-specified template
arguments into function template 'f'
DisableIf<std::is_enum<T>> f() { std::cout << "bar"; }
                           ^

-- 
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