ipa-cp: Perform operations in the appropriate types (PR 118097)
[gcc.git] / gcc / testsuite / g++.dg / template / conv19.C
blob7a3da939c1fb3ccc159ed5e9b5ac9338565d5e75
1 // PR c++/101698
2 // { dg-do compile { target c++11 } }
4 class Base {
5  public:
6   template <class T>
7   operator const T&() const = delete;
9   virtual operator const int&() const {
10     static int res;
11     return res;
12   }
15 template <class T>
16 class Derive : public Base {
17  public:
18   operator const T&() const override {
19     using Y = int;
20     //static_assert(__is_same_as(T,Y), "");
22     static int res;
24     res = Base::operator const Y&(); // OK
25     res = Base::operator const T&(); // { dg-bogus "deleted" }
26     return res;
27   }
30 int main() {
31   Derive<int> a;
32   const int& b = a;
33   (void)b;