Skip to content

no warning for << versus + precedence confusion #11075

@zygoloid

Description

@zygoloid
mannequin
Bugzilla Link 10703
Resolution FIXED
Resolved on Oct 05, 2012 16:56
Version unspecified
OS Linux
CC @dwblaikie,@Weverything

Extended Description

clang produces no warnings for the following:

int x[4] = // ...
int k = x[0] << 24 + x[1] << 16 + x[2] << 8 + x[3];

This parses as:

int k = x[0] << (24 + x[1]) << (16 + x[2]) << (8 + x[3]);

Such a warning would need to be careful to not fire on:

std::cout << x[0] << 24 + x[1] << 16 + x[2] << 8 + x[3];

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions