<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/141404>141404</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] ODR violation in Pass.h
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          imwints
      </td>
    </tr>
</table>

<pre>
    Downstream bug report https://bugs.gentoo.org/956603

```
/dev/shm/portage/llvm-core/mlir-21.0.0_pre20250523/work/mlir/include/mlir/Pass/Pass.h:400:7: error: virtual table of type ‘struct OperationPass’ violates one definition rule [-Werror=odr]
  400 | class OperationPass<void> : public Pass {
      |       ^
/dev/shm/portage/llvm-core/mlir-21.0.0_pre20250523/work/mlir/include/mlir/Pass/Pass.h:400:7: note: the conflicting type defined in another translation unit
  400 | class OperationPass<void> : public Pass {
      |       ^
/dev/shm/portage/llvm-core/mlir-21.0.0_pre20250523/work/mlir/include/mlir/Pass/Pass.h:189:25: note: virtual method ‘initialize’
  189 |   virtual LogicalResult initialize(MLIRContext *context) { return success(); }
      |                         ^
<built-in>: note: ought to match virtual method ‘__cxa_pure_virtual’ but does not
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```

According to https://wiki.gentoo.org/wiki/LTO we should enable `-Werror=odr` to detect possible runtime issues.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcVUGPozgT_TXOpRQEBhI45EA6jfRJ82lWrZX2GBlTAe8YG9nlpGd__cqE3u7M9JxXWoSCBVXPVS-vnoX3ajCIB1YeWXnaiECjdQc13ZQhv-ls__1wsjfjyaGYoAsDOJytIxiJZ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