mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			513 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			513 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
| pragma experimental SMTChecker;
 | |
| 
 | |
| contract C {
 | |
| 	bytes b;
 | |
| 
 | |
| 	function f() public {
 | |
| 		require(b.length == 0);
 | |
| 		b.push() = bytes1(uint8(1));
 | |
| 		assert(b[0] == bytes1(uint8(1)));
 | |
| 	}
 | |
| 
 | |
| 	function g() public {
 | |
| 		bytes1 one = bytes1(uint8(1));
 | |
| 		b.push() = one;
 | |
| 		assert(b[b.length - 1] == one);
 | |
| 		// Fails
 | |
| 		assert(b[b.length - 1] == bytes1(uint8(100)));
 | |
| 	}
 | |
| 
 | |
| }
 | |
| // ----
 | |
| // Warning 6328: (298-343): CHC: Assertion violation happens here.\nCounterexample:\nb = [1]\n\nTransaction trace:\nC.constructor()\nState: b = []\nC.g()
 |