Automatic template argument deduction fails for return type
If the argument cannot be deduced from func(a); then it cannot be deduced. auto return type can be deduced from the return statement, but not here. What you assign the return value to is not relevant. It simply doesnt work like this.
It does work however with a templated conversion:
#include <iostream>
#include <cstdio>

template <typename A,typename B>
A the_implementation(B x) { return x*2; }

template <typename B>
struct proxy {
    B b;
    template <typename A>
    operator A() {
        return the_implementation<A>(b);
    }
};

template<typename B>
proxy<B> func(B x) {
    return {x};
}


int main() { 
    int x = 42;
    int y = func(x);
}

func returns a proxy<B>, B is deduced from x. Then proxy<B> can be converted to int via its conversion operator, which calls the actual function (because only now A and B have been deduced).
However, I have doubts that the above is a good idea in your code. Consider to write instead:
auto b = func<uint64_t>(a);


I have a template function
template <typename B, typename A>
B func(A x) {/*do something*/}

And in my code I am doing something like
uint32_t a[6] = {1,2,3,4,5,6};
uint64_t b = func(a);

But this fails with
test.cxx:10:16: error: no matching function for call to 'func'
  uint64_t b = func(a);
               ^~~~~~~~~
test.cxx:5:6: note: candidate template ignored: couldn't infer template argument 'B'

So it seems that the type of a is automatically deduced but the type of b not. I can specify it (uint64_t b = <uint64_t>func(a);), sure, but why the compiler is not able to deduce it?
EDIT
Following comments also posting the content of the function (which is actually taking 2 other parameters)
template <typename B, typename A>
B bit_slice(A words[], int start, int end) {
  int wordSize = sizeof(A)*8;
  B s = 0;
  int n = end / wordSize;
  for(int i= 0; i <= n; ++i){
    s = (s << wordSize) + words[i];
  }
  s >>= (n+1) * wordSize - (end+1);
  B mask = (((T)1) << (end - start + 1))- 1;
  s &= mask;
  return s;
};

So basically a bit slicing of an array (representing something).
