mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Fixed ImVec2 operator[] violating aliasing rules causing issue with Intel C++ compiler. (#6272)
Note that this is not BayesBug's exact intended solution, so issues would be my responsibility ;) Amended.
This commit is contained in:
		| @@ -54,6 +54,8 @@ Other changes: | ||||
| - ColorEdit: Fixed shading of S/V triangle in Hue Wheel mode. (#5200, #6254) [@jamesthomasgriffin] | ||||
| - Rendering: Using adaptative tesselation for: RadioButton, ColorEdit preview circles, | ||||
|   Windows Close and Collapse Buttons. | ||||
| - Misc: Fixed ImVec2 operator[] violating aliasing rules causing issue with Intel C++ | ||||
|   compiler. (#6272) [@BayesBug] | ||||
| - IO: Fixed support for calling io.AddXXXX functions fron inactive context (wrongly | ||||
|   advertised as supported in 1.89.4). (#6199, #6256, #5856) [@cfillion] | ||||
| - Backends: OpenGL3: Fixed GL loader crash when GL_VERSION returns NULL. (#6154, #4445, #3530) | ||||
|   | ||||
							
								
								
									
										4
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -255,8 +255,8 @@ struct ImVec2 | ||||
|     float                                   x, y; | ||||
|     constexpr ImVec2()                      : x(0.0f), y(0.0f) { } | ||||
|     constexpr ImVec2(float _x, float _y)    : x(_x), y(_y) { } | ||||
|     float  operator[] (size_t idx) const    { IM_ASSERT(idx == 0 || idx == 1); return (&x)[idx]; }  // We very rarely use this [] operator, the assert overhead is fine. | ||||
|     float& operator[] (size_t idx)          { IM_ASSERT(idx == 0 || idx == 1); return (&x)[idx]; }  // We very rarely use this [] operator, the assert overhead is fine. | ||||
|     float& operator[] (size_t idx)          { IM_ASSERT(idx == 0 || idx == 1); return ((float*)(char*)this)[idx]; } // We very rarely use this [] operator, so the assert overhead is fine. | ||||
|     float  operator[] (size_t idx) const    { IM_ASSERT(idx == 0 || idx == 1); return ((const float*)(const char*)this)[idx]; } | ||||
| #ifdef IM_VEC2_CLASS_EXTRA | ||||
|     IM_VEC2_CLASS_EXTRA     // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2. | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut