Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0 -> main] Don't use deduced return type in test contract as it fails in template instantation #679

Closed
wants to merge 3 commits into from

Conversation

greg7mdp
Copy link
Contributor

Partially resolves #677.

This resolves the first issue:

/home/greg/github/enf/cdt/build_clang18_debug/bin/../include/eosiolib/contracts/eosio/multi_index.hpp:442:96: error: function 'primary_key' with deduced return type cannot be used before it is defined

Remaining issue

An issue remains with the use of the macro EOSIO_DISPATCH( eosiosystem::system_contract, ... in unittests/contracts/eosio.system/eosio.system.cpp.

Original issue was:

error: case value is not a constant expression because check() is not constexpr.

I tried making check() constexpr in cdt's libraries/eosiolib/core/eosio/check.hpp, but check calls the extern "C" functions eosio_assert which I don't think can be made constexpr.

So I tried updating the EOSIO_DISPATCH to use a series of if () ... else instead of a switch statement. This appears to work, but the EOSIO_DISPATCH still fails on this contract, and it appears that it is because it attempts to dispatch too many actions:

EOSIO_DISPATCH( eosiosystem::system_contract,
// native.hpp (newaccount definition is actually in eosio.system.cpp)
(newaccount)(updateauth)(deleteauth)(linkauth)(unlinkauth)(canceldelay)(onerror)(setabi)
// eosio.system.cpp
      (init)(setram)(setramrate)(setparams)(setpriv)(setalimits)(rmvproducer)(updtrevision)(bidname)(bidrefund)
// rex.cpp
      (deposit)(withdraw)(buyrex)(unstaketorex)(sellrex)(cnclrexorder)(rentcpu)(rentnet)(fundcpuloan)(fundnetloan)
      (defcpuloan)(defnetloan)(updaterex)(consolidate)(rexexec)(closerex)
// delegate_bandwidth.cpp
      (buyrambytes)(buyram)(sellram)(delegatebw)(undelegatebw)(refund)
// voting.cpp
      (regproducer)(unregprod)(voteproducer)(regproxy)
// producer_pay.cpp
      (onblock)(claimrewards)
)

The same macro builds fine if I remove a bunch of the actions. I wonder if we hit a preprocessor recursion limit, but I don't see an option to change it.

@greg7mdp greg7mdp requested review from heifner and linh2931 August 31, 2024 18:28
@greg7mdp
Copy link
Contributor Author

Closing this PR, I used the wrong branch. Sorry guys!

@greg7mdp greg7mdp closed this Aug 31, 2024
@linh2931
Copy link
Member

oh, I saw "merge 3 commits into main from release/1.0" but did not notice "Merge remote-tracking branch..." was missing. Will pay more attention next time.

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.

Fix compilation of test contracts in spring (using cdt 4.1.0-rc3)
3 participants