[Bug c++/45012] Invalid ambiguity on partial class specialization matching
rodolfo at rodsoft dot org
gcc-bugzilla@gcc.gnu.org
Wed Jul 21 02:49:00 GMT 2010
------- 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
More information about the Gcc-bugs
mailing list