Internals: Fix VL_RESTORER behavior on passing a lvalue reference (#3326)

Signed-off-by: HungMingWu <u9089000@gmail.com>
This commit is contained in:
HungMingWu 2022-02-27 15:52:11 +08:00 committed by GitHub
parent b6ca2a42f2
commit 43a84d7ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,7 @@ class V3HierBlockPlan;
/// end-of-stope.
// Object must be named, or it will not persist until end-of-scope.
// Constructor needs () or GCC 4.8 false warning.
#define VL_RESTORER(var) const VRestorer<decltype(var)> restorer_##var(var);
#define VL_RESTORER(var) const VRestorer<typename std::decay<decltype(var)>::type> restorer_##var(var);
// Object used by VL_RESTORER. This object must be an auto variable, not
// allocated on the heap or otherwise.