mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			565 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			565 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
| contract B
 | |
| {
 | |
| }
 | |
| 
 | |
| contract A {
 | |
|     function different_salt() public returns (bool) {
 | |
|         B x = new B{salt: "abc"}();
 | |
|         B y = new B{salt: "abcef"}();
 | |
|         return x != y;
 | |
|     }
 | |
|     function same_salt() public returns (bool) {
 | |
|         B x = new B{salt: "xyz"}();
 | |
|         try new B{salt: "xyz"}() {} catch {
 | |
|             return true;
 | |
|         }
 | |
|         return false;
 | |
|     }
 | |
| }
 | |
| // ====
 | |
| // EVMVersion: >=constantinople
 | |
| // ----
 | |
| // different_salt() -> true
 | |
| // same_salt() -> true
 | |
| // gas irOptimized: 98438897
 | |
| // gas legacy: 98439109
 | |
| // gas legacyOptimized: 98438967
 |