public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55766] New: temlate alias is not equivalent (const-ness is not recognized)
@ 2012-12-20 18:36 leonid at volnitsky dot com
  2012-12-20 18:37 ` [Bug c++/55766] " leonid at volnitsky dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: leonid at volnitsky dot com @ 2012-12-20 18:36 UTC (permalink / raw)
  To: gcc-bugs


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: unassigned@gcc.gnu.org
        ReportedBy: leonid@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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-12-23 17:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20 18:36 [Bug c++/55766] New: temlate alias is not equivalent (const-ness is not recognized) leonid at volnitsky dot com
2012-12-20 18:37 ` [Bug c++/55766] " leonid at volnitsky dot com
2012-12-20 18:58 ` paolo.carlini at oracle dot com
2012-12-20 23:47 ` [Bug c++/55766] template " daniel.kruegler at googlemail dot com
2012-12-21  5:32 ` leonid at volnitsky dot com
2012-12-21  9:48 ` paolo.carlini at oracle dot com
2012-12-23 17:01 ` dodji at seketeli dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).