Skip to content

Fix a compilation issue in TestTLogServer.actor.cpp#11515

Merged
jzhou77 merged 1 commit into
apple:mainfrom
sepeth:Fix_build_due_to_TestTLogServer.actor.cpp
Jul 17, 2024
Merged

Fix a compilation issue in TestTLogServer.actor.cpp#11515
jzhou77 merged 1 commit into
apple:mainfrom
sepeth:Fix_build_due_to_TestTLogServer.actor.cpp

Conversation

@sepeth

@sepeth sepeth commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

Without this change, cmake --build fails with (on macOS with Apple clang 15.0.0):

fdbserver/TestTLogServer.actor.cpp:363:125: error: use 'template' keyword to treat 'getReply' as a dependent template name

Full error:

FAILED: fdbserver/CMakeFiles/fdbserver.dir/TestTLogServer.actor.g.cpp.o
/opt/homebrew/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DFMT_SHARED -DNO_INTELLISENSE -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -DCOMPILATION_UNIT=/Users/sepeth/Code/foundationdb/build/fdbserver/TestTLogServer.actor.g.cpp -I/Users/sepeth/Code/foundationdb/bindings/c -I/Users/sepeth/Code/foundationdb/build/bindings/c -I/Users/sepeth/Code/foundationdb/fdbserver/include -I/Users/sepeth/Code/foundationdb/build/fdbserver/include -I/Users/sepeth/Code/foundationdb/fdbclient/include -I/Users/sepeth/Code/foundationdb/build/fdbclient/include -I/Users/sepeth/Code/foundationdb/fdbrpc/include -I/Users/sepeth/Code/foundationdb/build/fdbrpc/include -I/Users/sepeth/Code/foundationdb/flow/include -I/Users/sepeth/Code/foundationdb/build/flow/include -I/Users/sepeth/Code/foundationdb/contrib/libb64/include -I/Users/sepeth/Code/foundationdb/contrib/SimpleOpt/include -I/Users/sepeth/Code/foundationdb/contrib/crc32/include -I/Users/sepeth/Code/foundationdb/contrib/md5/include -I/Users/sepeth/Code/foundationdb/metacluster/include -I/Users/sepeth/Code/foundationdb/build/metacluster/include -I/Users/sepeth/Code/foundationdb/contrib/sqlite -I/Users/sepeth/Code/foundationdb/contrib/rapidjson -isystem /opt/homebrew/include -isystem /opt/homebrew/Cellar/openssl@3/3.3.1/include -isystem /Users/sepeth/Code/foundationdb/build/boost_install/include -isystem /Users/sepeth/Code/foundationdb/build/msgpackProject-prefix/src/msgpackProject/include -isystem /Users/sepeth/Code/foundationdb/build/toml11/include -Wl,-ld_classic -stdlib=libc++ -O3 -DNDEBUG -std=gnu++20 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -DCMAKE_BUILD -fno-omit-frame-pointer -gdwarf-4 -ggdb1 -gz -Wall -Wextra -Wredundant-move -Wpessimizing-move -Woverloaded-virtual -Wshift-sign-overflow -Wno-sign-compare -Wno-undefined-var-template -Wno-unknown-warning-option -Wno-unused-parameter -Wno-constant-logical-operand -Wno-deprecated-copy -Wno-delete-non-abstract-non-virtual-dtor -Wno-range-loop-construct -Wno-reorder-ctor -Wno-unused-command-line-argument -Wno-ambiguous-reversed-operator -Wno-unused-function -Wno-unused-private-field -Wno-nullability-completeness -Wno-macro-redefined -Wno-register -Wno-error=format -Wunused-variable -Wno-deprecated -fvisibility=hidden -Wreturn-type -fPIC -DHAVE_OPENSSL -MD -MT fdbserver/CMakeFiles/fdbserver.dir/TestTLogServer.actor.g.cpp.o -MF fdbserver/CMakeFiles/fdbserver.dir/TestTLogServer.actor.g.cpp.o.d -o fdbserver/CMakeFiles/fdbserver.dir/TestTLogServer.actor.g.cpp.o -c /Users/sepeth/Code/foundationdb/build/fdbserver/TestTLogServer.actor.g.cpp
/Users/sepeth/Code/foundationdb/fdbserver/TestTLogServer.actor.cpp:363:125: error: use 'template' keyword to treat 'getReply' as a dependent template name
                        StrictFuture<TLogLockResult> __when_expr_3 = pTLogTestContextEpochOne->pTLogContextList[tLogIdx]->TestTLogInterface.lock.getReply<TLogLockResult>();
                                                                                                                                                 ^
                                                                                                                                                 template
/Users/sepeth/Code/foundationdb/fdbserver/TestTLogServer.actor.cpp:363:125: error: use 'template' keyword to treat 'getReply' as a dependent template name
                        StrictFuture<TLogLockResult> __when_expr_3 = pTLogTestContextEpochOne->pTLogContextList[tLogIdx]->TestTLogInterface.lock.getReply<TLogLockResult>();
                                                                                                                                                 ^
                                                                                                                                                 template
2 errors generated.

Not sure why it got reported as 2 errors, but the error makes sense according to the ISO C++ 14.2/4:

When the name of a member template specialization appears after . or -> in a postfix-expression or after a
nested-name-specifier in a qualified-id, and the object expression of the postfix-expression is type-dependent
or the nested-name-specifier in the qualified-id refers to a dependent type, but the name is not a member of
the current instantiation (14.6.2.1), the member template name must be prefixed by the keyword template.
Otherwise the name is assumed to name a non-template. Example:

struct X {
  template<std::size_t> X* alloc();
  template<std::size_t> static X* adjust();
};

template<class T> void f(T* p) {
  T* p1 = p->alloc<200>();           // ill-formed: < means less than
  T* p2 = p->template alloc<200>();  // OK: < starts template argument list
  T::adjust<100>();                  // ill-formed: < means less than
  T::template adjust<100>();         // OK: < starts template argument list
} ```

Code-Reviewer Section

The general pull request guidelines can be found here.

Please check each of the following things and check all boxes before accepting a PR.

  • The PR has a description, explaining both the problem and the solution.
  • The description mentions which forms of testing were done and the testing seems reasonable.
  • Every function/class/actor that was touched is reasonably well documented.

For Release-Branches

If this PR is made against a release-branch, please also check the following:

  • This change/bugfix is a cherry-pick from the next younger branch (younger release-branch or main if this is the youngest branch)
  • There is a good reason why this PR needs to go into a release branch and this reason is documented (either in the description above or in a linked GitHub issue)

Without this change, `cmake --build` fails with (on macOS with Apple clang 15.0.0):

fdbserver/TestTLogServer.actor.cpp:363:125: error: use 'template' keyword to treat 'getReply' as a dependent template name
@jzhou77 jzhou77 closed this Jul 17, 2024
@jzhou77 jzhou77 reopened this Jul 17, 2024
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 0a3b496
  • Duration 0:18:30
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

  • Commit ID: 0a3b496
  • Duration 0:37:43
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS Ventura 13.x

  • Commit ID: 0a3b496
  • Duration 0:47:15
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 0a3b496
  • Duration 0:50:32
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 0a3b496
  • Duration 0:51:44
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 0a3b496
  • Duration 1:04:19
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 0a3b496
  • Duration 1:10:58
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@xis19

xis19 commented Jul 17, 2024

Copy link
Copy Markdown
Collaborator

The reason you see two errors is that we have a transpiler that compiles XXX.actor.cpp into XXX.actor.g.cpp. In the XXX.actor.g.cpp there is mapping between the real C++ code to the ACTOR code. You see an error from actor.g.cpp and an error from actor.cpp.

I also do not understand why an explicit template is required.

@jzhou77

jzhou77 commented Jul 17, 2024

Copy link
Copy Markdown
Collaborator

IDE error is fixed by #11516

@jzhou77 jzhou77 merged commit ba59e9a into apple:main Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants