public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rodolfo at rodsoft dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/45012] Invalid ambiguity on partial class specialization matching
Date: Wed, 21 Jul 2010 02:49:00 -0000	[thread overview]
Message-ID: <20100721024936.9218.qmail@sourceware.org> (raw)
In-Reply-To: <bug-45012-6196@http.gcc.gnu.org/bugzilla/>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]



------- Comment #1 from rodolfo at rodsoft dot org  2010-07-21 02:49 -------
The code I posted was meant to be compiled in c++0x mode, but if we write
directly the definition of std::enable_if, it also happens in c++03 mode.
So, instead of #include <type_traits>, one should write:

template <bool B, class T=void> struct enable_if;

template <class T>
struct enable_if<true,T> 
{  
    typedef T type;
};

Of course, I forgot to add the error messages:

teste.cpp:30: error: ambiguous class template instantiation for ‘struct
foo<bar<2>, bar<2>, void>’
teste.cpp:19: error: candidates are: struct foo<V<M>, V<M>, typename
enable_if<((M == RUNTIME) || (M == 2)), void>::type>
teste.cpp:25: error:                 struct foo<V1<M>, V2<M>, typename
enable_if<((M == RUNTIME) || (M == 2)), void>::type>
teste.cpp:30: error: aggregate ‘foo<bar<2>, bar<2>, void> x’ has incomplete
type and cannot be defined


-- 

rodolfo at rodsoft dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rodolfo at rodsoft dot org
           Keywords|                            |rejects-valid
      Known to fail|                            |4.4.3 4.5.0


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


  reply	other threads:[~2010-07-21  2:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21  2:43 [Bug c++/45012] New: " rodolfo at rodsoft dot org
2010-07-21  2:49 ` rodolfo at rodsoft dot org [this message]
2010-07-21  2:53 ` Andrew Pinski
2010-07-21  2:54 ` [Bug c++/45012] " pinskia at gmail dot com
2010-07-21  3:03 ` rodolfo at rodsoft dot org
     [not found] <bug-45012-4@http.gcc.gnu.org/bugzilla/>
2011-09-26 18:31 ` paolo.carlini at oracle dot com
2011-09-27  2:40 ` jason at gcc dot gnu.org
2011-11-17 16:11 ` ramana at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100721024936.9218.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).