This varies by airline. Some airlines require passengers to fit their bags into a measuring device before boarding; others are more lenient, especially if the flight is not full. Some low-cost carriers (the now-defunct WOW among them), are notorious for weighing and measuring each carry-on bag, prompting some passengers to wear multiple layers of clothes on the plane to meet the requirements.