This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53236] using declaration and base function template overloading
- From: "fpelliccioni at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 05 May 2012 22:01:23 +0000
- Subject: [Bug c++/53236] using declaration and base function template overloading
- Auto-submitted: auto-generated
- References: <bug-53236-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53236
--- Comment #6 from Fernando Pelliccioni <fpelliccioni at gmail dot com> 2012-05-05 22:01:23 UTC ---
// g++ -std=c++11 gcc_error_simple.cpp
// g++ -DWITH_USING_DECLARATION -std=c++11 gcc_error_simple.cpp
#include <iostream>
#include <type_traits>
#include <typeinfo>
template <typename T>
struct Base
{
template <typename T2>
typename std::enable_if<std::is_same<T, T2>::value, T>::type
get()
{
}
};
template <typename T>
struct Derived : Base<int>
{
typedef Base<int> base;
#ifdef WITH_USING_DECLARATION
using base::get;
#endif
template <typename T2>
typename std::enable_if<std::is_same<T, T2>::value, T>::type
get()
{
}
};
int main( /* int argc, char* argv[] */ )
{
Derived<double> d;
auto xxx = d.get<double>();
//std::cout << typeid(xxx).name() << std::endl;
auto yyy = d.get<int>(); // #ifndef WITH_USING_DECLARATION ->
Compile-time error -> GCC is behaving incorrectly. Base<int>::get<int>()
should not be hidden
// #ifdef
WITH_USING_DECLARATION -> No Compile-time error -> GCC is behaving incorrectly.
Base<int>::get<int>() must be hidden.
//std::cout << typeid(yyy).name() << std::endl;
return 0;
}