This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45012] Invalid ambiguity on partial class specialization matching
- From: "rodolfo at rodsoft dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jul 2010 02:49:36 -0000
- Subject: [Bug c++/45012] Invalid ambiguity on partial class specialization matching
- References: <bug-45012-6196@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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