mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Solidity
		
	
	
	
	
	
pragma abicoder v2;
 | 
						|
struct S { uint a; string b; }
 | 
						|
error E(uint a, S s, uint b);
 | 
						|
contract C {
 | 
						|
    S s;
 | 
						|
    function f(bool c) public {
 | 
						|
        if (c) {
 | 
						|
            s.a = 9;
 | 
						|
            s.b = "abc";
 | 
						|
            revert E(2, s, 7);
 | 
						|
        } else {
 | 
						|
            revert E({b: 7, a: 2, s: S({b: "abc", a: 9})});
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
// ====
 | 
						|
// compileViaYul: also
 | 
						|
// compileToEwasm: also
 | 
						|
// ----
 | 
						|
// f(bool): true -> FAILURE, hex"e96e07f0", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"0000000000000000000000000000000000000000000000000000000000000007", hex"0000000000000000000000000000000000000000000000000000000000000009", hex"0000000000000000000000000000000000000000000000000000000000000040", hex"0000000000000000000000000000000000000000000000000000000000000003", hex"6162630000000000000000000000000000000000000000000000000000000000"
 | 
						|
// f(bool): false -> FAILURE, hex"e96e07f0", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"0000000000000000000000000000000000000000000000000000000000000007", hex"0000000000000000000000000000000000000000000000000000000000000009", hex"0000000000000000000000000000000000000000000000000000000000000040", hex"0000000000000000000000000000000000000000000000000000000000000003", hex"6162630000000000000000000000000000000000000000000000000000000000"
 |