https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69283

            Bug ID: 69283
           Summary: Auto deduction fails when ADL is required
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gccbugs at astrant dot net
  Target Milestone: ---

The following code

```
namespace Ape {
    struct Type {};
        template <typename T>
        auto f1(T const& v){
                return true;
        }
}

namespace Baboon {
        template <typename T>
        bool f3(T const& v){
                return f1(v);
        }
}

int main(){
        Ape::Type x;
        Baboon::f3(x);
}
```

Doesn't compile with g++ (GCC) 5.3.0 under arch linux.
Commandline: g++ -std=c++14 test.cpp
Output:

test.cpp: In instantiation of ‘bool Baboon::f3(const T&) [with T = Ape::Type]’:
test.cpp:18:14:   required from here
test.cpp:12:12: error: use of ‘template<class T> auto Ape::f1(const T&)’ before
deduction of ‘auto’
   return f1(v);
            ^
test.cpp:12:12: error: use of ‘auto Ape::f1(const T&) [with T = Ape::Type]’
before deduction of ‘auto’

When specifying the namespace in Babboon::f3 for the call to f1 (example
follows), it works as expected.

namespace Baboon {
        template <typename T>
        bool f3(T const& v){
                return Ape::f1(v);
        }
}

Reply via email to