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

             Bug #: 55766
           Summary: temlate alias is not equivalent (const-ness is not
                    recognized)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: leo...@volnitsky.com


Created attachment 29016
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29016
goog.ii

I have following alias in my code:

    template<bool Cnd, class T=void>  
    using  eIF = typename std::enable_if <Cnd,T>::type;

I encountered code where alias is not equivalent to direct use of enable_if.

Attached are good.ii (with enable_if) which both GCC480-20121220 and CLANG32
can compile, and bad.ii (with alias eIF), which only CLANG can compile. 


    diff good.ii bad.ii

    80517c80517
    <   typename std::enable_if<(sizeof(Arg1),N==1), Arg1>::type
    ---
    >   eIF<(sizeof(Arg1),N==1), Arg1>
    80522c80522
    <   typename std::enable_if<(sizeof(Arg1),N==2), Arg2>::type
    ---
    >   eIF<(sizeof(Arg1), N==2), Arg2>

Comma op in expression (sizeof(Arg1),N==1) used to makes templated member
function depend on Arg1 template argument (to trigger SFINAE). 

Error message:

lambda.h:45:2: error: integral expression ‘(0, false)’ is not constant

Reply via email to