[Mlir-commits] [mlir] Revert "[mlir] Fix a warning" (PR #73640)

Kazu Hirata llvmlistbot at llvm.org
Tue Dec 12 15:44:35 PST 2023


kazutakahirata wrote:

> > mlir/lib/Pass/PassRegistry.cpp:376:37: error: ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~' [-Werror,-Wdtor-name]
> 
> Which compiler complains about this and do we understand why? The message isn't clear to me?

I'm using `/usr/bin/clang++-16` that comes with Debian.

> > Does this mean we need to check the C++ version like so?
> > #if __cplusplus >= 202002L
> > llvm::cl::OptionValue::~OptionValue() = default;
> > #else
> > llvm::cl::OptionValue::~OptionValue() = default;
> > #endif
> 
> That could be an option, but to me this is only valid if we can point to the change in the standard that justifies this (that is: we are actually adjusting for the C++ standard and not working around a quirks or a particular compiler version).

Here is a relevant Stackoverflow post:

https://stackoverflow.com/questions/68751682/is-a-class-templates-name-in-scope-for-a-qualified-out-of-line-destructors-def

According to the post, the relevant portion of the C++ standard is changing, and C++23 doesn't seem to require the template type to be repeated:

```
llvm::cl::OptionValue<OpPassManager>::~OptionValue() = default;
```

@alexbatashev, you mention https://eel.is/c++draft/diff.cpp17.class#2, but do you happen to know if the "simple-template-id not allowed" rule is relevant to a destructor defined outside the class/struct scope?


https://github.com/llvm/llvm-project/pull/73640


More information about the Mlir-commits mailing list