Issue 143329
Summary [clang-tidy] Check request: bugprone-unreached-function-overload
Labels clang-tidy
Assignees
Reporter denzor200
    ```
template<typename T>
void foo(T x) { std::cout << "Template: " << x << "\n"; }

int main() {
    foo(42);      // OK: `Template: 42`
    foo("hello"); // BAD: `Template: hello` (`const char*: hello` expected)
}

// defined after it's being used
void foo(const char* s) { std::cout << "const char*: " << s << "\n"; }
```

Possible fix is to declare `foo(const char* s)` before `main` function.
Another fix is to move `foo(const char* s)` definition before `main` function.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to