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

    <tr>
        <th>Summary</th>
        <td>
            [ODR] Is it a real ODR violation if one of the member functions don't have a body
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:modules
      </td>
    </tr>

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

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

<pre>
    In `clang/test/Modules/odr_hash.cpp`, we can see cases like:

```
#if defined(FIRST)
struct S3 {
  int FirstBody() { return 0; }
};
#elif defined(SECOND)
struct S3 {
  int FirstBody();
};
#else
S3 s3;
// expected-error@first.h:* {{'MethodBody::S3' has different definitions in different modules; first difference is definition in module 'FirstModule' found method 'FirstBody' with body}}
// expected-note@second.h:* {{but in 'SecondModule' found method 'FirstBody' with no body}}
#endif

#if defined(FIRST)
struct S4 {
  int SecondBody();
};
#elif defined(SECOND)
struct S4 {
  int SecondBody() { return 0; }
};
#else
S4 s4;
// expected-error@first.h:* {{'MethodBody::S4' has different definitions in different modules; first difference is definition in module 'FirstModule' found method 'SecondBody' with no body}}
// expected-note@second.h:* {{but in 'SecondModule' found method 'SecondBody' with body}}
#endif
```

That said, is it a ODR violation if we define a member function in a unit and declare it in another unit?

I think this is a false-positive check. I don't think `http://eel.is/c++draft/basic.def.odr#14.3` can apply here since `int FirstBody();` and `int SecondBody();` are not definitions according to http://eel.is/c++draft/basic.def#2.1.

CC: @zygoloid for being sure about this.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVUFv4zYT_TXjyyACRcqSddDBjj8DPuwXIN5DbwUtjiw2NOmSVLbpry8oOV7HTbsJ0KKAQYEech7nvcehDEEfLFED8xXM1zM5xN755r4fpP1V_zTUs71TL83WIpSsNdIegG8ihQh888WpwVAAvnHK_9zL0Gft6QQlA36P3whbaTFQ-gYKaP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