簡體   English   中英

我不斷從以前使用的工作代碼中收到“錯誤:constexpr 變量'x'必須由常量表達式初始化”

[英]I keep getting an "error: constexpr variable 'x' must be initialized by a constant expression" from previously used working code

這幾天我一直在撓頭。 一步一步地刪除和添加行並在每個階段重新編譯,直到它中斷。

  ACTION act1( name nm, uint64_t ammount );
  ACTION act2(name nm, uint64_t signing_value);
  ACTION receiverand(name nm, checksum256& random_value);
  ACTION act4(name nm, uint64_t stake);
  ACTION act5(uint64_t num);
  ACTION act6(name nm);

  using act1_action = action_wrapper<"act1"_n, &project::act1>;
  using act2_action = action_wrapper<"act2"_n, &project::act2>;
  using receiverand_action = action_wrapper<"receiverand"_n, &project::receiverand>;
  using act4_action = action_wrapper<"act4"_n, &project::act4>;
  using act5_action = action_wrapper<"act5"_n, &project::act5>;
  using act6_action = action_wrapper<"act6"_n, &project::act6>;

當我添加act6時出現問題。 我必須采取行動4,一切正常。 所以我加了 5 和 6,然后拋出了錯誤,所以我又加了 5,一切都還好。 這是我不斷收到的錯誤

 error: constexpr variable 'x' must be initialized by a constant expression
        constexpr auto x = 
        eosio::name{std::string_view{eosio::detail::to_const_char_arr<Str...>::value, 
        sizeof...(Str)}};

  note: in instantiation of function template specialization 'operator""_n<char, 'a', 
        'c', 't', '6'>' requested here
        using act6_action = action_wrapper<"act6"_n, &project::act6>;

 note: non-constexpr function 'check' cannot be used in a constant expression
       eosio::check( false, "character is not in allowed character set for names" );

似乎名稱不能包含字符'6' ,而只能包含'1''5'

 Action names [...] May contain: az, 1-5, or.

https://eosio.stackexchange.com/questions/7/what-are-naming-rules-for-actions-tables-and-contracts

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM