[Bug c++/50921] New: GCC cannot find dependent conversion-function-id even if there's a using declaration for it

schaub.johannes at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sun Oct 30 13:26:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50921

             Bug #: 50921
           Summary: GCC cannot find dependent conversion-function-id even
                    if there's a using declaration for it
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schaub.johannes@googlemail.com


The following code should compile but doesn't.

------- snip
template<typename T>
struct Type { int x; };

template<typename T>
struct Base {
  operator Type<int>();
};

template<typename T>
struct Derived : Base<T> {
  using Base<T>::operator Type<T>;
  void f() { 
    int x = operator Type<T>().x; 
    (void) x;
  }
};

int main() {
  Derived<int> d;
  d.f();
}
------- snap

Error:
------- snip
main1.cpp:13:30: error: there are no arguments to 'operator Type<T>' that
depend on a template parameter, so a declaration of 'operator Type<T>' must be
available
------- snap

The function call is dependent by the dependent function name itself, it
doesn't need dependent call arguments in this case in order to be dependent.



More information about the Gcc-bugs mailing list