title: The compiler optimized away a variable I need
body: <p>I have a class, AssetInstance:</p>
  
  <pre><code>#pragma once
  
  #include "Asset.h"
  
  #define GRAVITATIONAL_CONSTANT -2.45f
  
  class AssetInstance
  {
  private:
      GLfloat maxX();
      GLfloat maxY();
      GLfloat maxZ();
  
      GLfloat minX();
      GLfloat minY();
      GLfloat minZ();
  
  public:
      AssetInstance();
      ~AssetInstance();
      void updateBoundaries();
      void calculateMinAndMaxXYZ();
      glm::mat4 translate();
      glm::mat4 scale();
      void updatePosition();
      GLfloat timeInSeconds(long int time);
      GLfloat randomFloat();
  
      Asset* asset;
      glm::vec3 position;
      glm::vec3 size;
      glm::vec3 materialColor;
      glm::vec3 materialSpecularColor;
      GLfloat materialShininess;
      long int lastTime;
      glm::vec3 velocity;
      glm::vec3 acceleration;
      std::vector&lt;glm::vec3&gt; vertices;
      glm::vec3 max;
      glm::vec3 min;
  };
  </code></pre>
  
  <p>and the function calculateMinAndMaxXYZZ() sets max.x, max.y, max.z to their max values and does the same thing with min and the minimum values.</p>
  
  <p>However when I run my calculateMinxAndMaxXYZ() function, I get a message that my variable has been optimized away and not available... How do I stop this?</p>
  
  <p>If I step into the class when the error is thrown, this is what it looks like</p>
  
  <p><img src="https://i.stack.imgur.com/Pfgrx.jpg" alt="enter image description here"></p>