[Bug 1827800] [NEW] Polymorphism issue. Member function of parent class is not visible

Alexey Kozin 1827800 at bugs.launchpad.net
Sun May 5 20:15:41 UTC 2019


Public bug reported:

Struct A declares a function 'f' with a parameter of type typename std::integral_constant<size_t,0>::type.
Struct B inherits class A and declares a function with a parameter of type typename std::integral_constant<size_t,1>::type and the same name 'f'.
A::f is not accessible.


struct A
{
	static void f(typename std::integral_constant<size_t,0>::type){}
};

struct B: public A
{
	static void f(typename std::integral_constant<size_t,1>::type){}
};

void tst()
{
	B::f(std::integral_constant<size_t,0>::type());
}

error: no matching function for call to ‘B::f(std::integral_constant<long unsigned int, 0>::type)’
no known conversion for argument 1 from ‘std::integral_constant<long unsigned int, 0>::type {aka std::integral_constant<long unsigned int, 0>}’ to ‘std::integral_constant<long unsigned int, 1>::type {aka std::integral_constant<long unsigned int, 1>}’

** Affects: gcc-7 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "bug2.ii"
   https://bugs.launchpad.net/bugs/1827800/+attachment/5261664/+files/bug2.ii

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1827800

Title:
  Polymorphism issue. Member function of parent class is not visible

Status in gcc-7 package in Ubuntu:
  New

Bug description:
  Struct A declares a function 'f' with a parameter of type typename std::integral_constant<size_t,0>::type.
  Struct B inherits class A and declares a function with a parameter of type typename std::integral_constant<size_t,1>::type and the same name 'f'.
  A::f is not accessible.

  
  struct A
  {
  	static void f(typename std::integral_constant<size_t,0>::type){}
  };

  struct B: public A
  {
  	static void f(typename std::integral_constant<size_t,1>::type){}
  };

  void tst()
  {
  	B::f(std::integral_constant<size_t,0>::type());
  }

  error: no matching function for call to ‘B::f(std::integral_constant<long unsigned int, 0>::type)’
  no known conversion for argument 1 from ‘std::integral_constant<long unsigned int, 0>::type {aka std::integral_constant<long unsigned int, 0>}’ to ‘std::integral_constant<long unsigned int, 1>::type {aka std::integral_constant<long unsigned int, 1>}’

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1827800/+subscriptions



More information about the foundations-bugs mailing list