I am compiling a contract from browser-solidity,but I am getting Error: Expected token Semicolon got 'RBrace' . The part of contract that throws error is:

contract owned {
address public owner;

function owned() {
    owner = msg.sender;

modifier onlyOwner {
    if (msg.sender != owner) throw;
} }

The surprising thing is same contract is deployed from Mist without any issue. So why browser solidity is throwing error.Is there a bug in solidity-compiler or something is not right with my contract?


You now need to add a semicolon after _, so your code should read _;.

From Solidity - Version 0.4.0:

Minimal changes to be made for upgrade:

  • Add payable to all functions that want to receive Ether (including the constructor and the fallback function).
  • Change _ to _; in modifiers.
  • Add version pragma to each file: pragma solidity ^0.4.0;

Breaking Changes:

  • Source files have to specify the compiler version they are compatible with using e.g. pragma solidity ^0.4.0; or pragma solidity >=0.4.0 <0.4.8;
  • Functions that want to receive Ether have to specify the new payable modifier (otherwise they throw).
  • Contracts that want to receive Ether with a plain "send" have to implement a fallback function with the payable modifier. Contracts now throw if no payable fallback function is defined and no function matches the signature.
  • Failing contract creation through "new" throws.
  • Division / modulus by zero throws.
  • Function call throws if target contract does not have code
  • Modifiers are required to contain _ (use if (false) _ as a workaround if needed).
  • Modifiers: return does not skip part in modifier after _.
  • Placeholder statement _ in modifier now requires explicit ;.
  • ecrecover now returns zero if the input is malformed (it previously returned garbage).
  • The constant keyword cannot be used for constructors or the fallback function.
  • Removed --interface (Solidity interface) output option
  • JSON AST: General cleanup, renamed many nodes to match their C++ names.
  • JSON output: srcmap-runtime renamed to srcmapRuntime.
  • Moved (and reworked) standard library contracts from inside the compiler to github.com/ethereum/solidity/std (import "std"; or import owned; do not work anymore).
  • Confusing and undocumented keyword after was removed.
  • New reserved words: abstract, hex, interface, payable, pure, static, view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.