[libcxx-commits] [PATCH] D103769: [libcxx] Implement P0883R2 ("Fixing Atomic Initialization")

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 7 10:35:35 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/atomics/atomics.types.generic/constexpr_noexcept.pass.cpp:29
+
+int main() {
+  static_assert(test<std::atomic<bool>>());
----------------
Mordante wrote:
> Since the test is compile-time only there's no need for a run-time check. Can you make the following changes
> - rename the file to `constexpr_noexcept.compile.pass.cpp`
> - `int main()` -> `void test()`
> - Add the following two lines at the end:
> ```
> // Required for MSVC internal test runner compatibility.
> int main(int, char**) { return 0; }
> ```
I'm in agreement on the first two bullet points, but on the third point, I believe we have an unwritten policy that .compile.pass.cpp tests specifically //must not// contain `int main`, because otherwise there's a hazard that people will unwittingly add code to `main` expecting it to run. We have lots of .compile.pass.cpp tests these days that don't contain a `main`:
```
$ find libcxx/test -name \*.compile.pass.cpp | xargs grep -l main | wc -l
      31
$ find libcxx/test -name \*.compile.pass.cpp | xargs grep -L main | wc -l
     185
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103769/new/

https://reviews.llvm.org/D103769



More information about the libcxx-commits mailing list