[flang-commits] [flang] [Flang][#212316] Fix -Wunused-template errors under -Werror (PR #218985)
via flang-commits
flang-commits at lists.llvm.org
Sat Sep 5 12:22:43 PDT 2026
================
@@ -15,8 +15,7 @@ namespace Fortran::evaluate {
// DOT_PRODUCT
template <typename T>
-static Expr<T> FoldDotProduct(
- FoldingContext &context, FunctionRef<T> &&funcRef) {
+Expr<T> FoldDotProduct(FoldingContext &context, FunctionRef<T> &&funcRef) {
----------------
zhangweize9-cyber wrote:
(Assisted-by: Google AI Mode) If this header file is included by two or more .cpp files (Translation Units) using `#include`, when they are compiled into .o object files and handed over to the linker for packaging, the linker will directly report an error and crash.
```
ld: error: duplicate symbol: FoldDotProduct(...)
defined in file_A.o
defined in file_B.o
```
(solution) [Here's the stackoverflow link.](https://stackoverflow.com/questions/68186806/why-does-defining-functions-in-header-files-create-multiple-definition-errors-b) If the `inline` keyword is not added, it will occur during the linking process. Because there are multiple definitions.
https://github.com/llvm/llvm-project/pull/218985
More information about the flang-commits
mailing list