[flang] Patches to permit building with Clang without notes or warnings.
Original-commit: flang-compiler/f18@0e74b10603ecceaca1781ecd0ee630de89e8e7f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
diff --git a/flang/lib/parser/unparse.cc b/flang/lib/parser/unparse.cc
index 4fc58f7..76425e1 100644
--- a/flang/lib/parser/unparse.cc
+++ b/flang/lib/parser/unparse.cc
@@ -29,23 +29,18 @@
template<typename T> void Before(const T &) {}
template<typename T> double Unparse(const T &); // not void, never used
- template<typename T>
- auto Pre(const T &x) ->
- typename std::enable_if<std::is_void_v<decltype(Unparse(x))>,
- bool>::type {
- // There is a local definition of Unparse() for this type. It
- // overrides the parse tree walker's default Walk() over the descendents.
- Before(x);
- Unparse(x);
- Post(x);
- return false; // Walk() does not visit descendents
- }
- template<typename T>
- auto Pre(const T &x) ->
- typename std::enable_if<!std::is_void_v<decltype(Unparse(x))>,
- bool>::type {
- Before(x);
- return true; // there's no Unparse() defined here, Walk() the descendents
+ template<typename T> bool Pre(const T &x) {
+ if constexpr (std::is_void_v<decltype(Unparse(x))>) {
+ // There is a local definition of Unparse() for this type. It
+ // overrides the parse tree walker's default Walk() over the descendents.
+ Before(x);
+ Unparse(x);
+ Post(x);
+ return false; // Walk() does not visit descendents
+ } else {
+ Before(x);
+ return true; // there's no Unparse() defined here, Walk() the descendents
+ }
}
template<typename T> void Post(const T &) {}