Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang incorrectly thinks that enumerators of enum does not fit in the largest integer type #24667

Open
yeah-boi mannequin opened this issue Jul 29, 2015 · 0 comments · May be fixed by #78742
Open

Clang incorrectly thinks that enumerators of enum does not fit in the largest integer type #24667

yeah-boi mannequin opened this issue Jul 29, 2015 · 0 comments · May be fixed by #78742
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@yeah-boi
Copy link
Mannequin

yeah-boi mannequin commented Jul 29, 2015

Bugzilla Link 24293
Version trunk
OS All
CC @DougGregor

Extended Description

Consider the following well-formed program (prog.cc):

#include
enum E { x = std::numeric_limits::max(), y };
int main() {}

Compile it with the following command line:

clang++ prog.cc -stdlib=libc++ -std=c++14 -pedantic-errors

The enumerators x and y fits in unsigned long long int, but clang incorrectly gives the following error message:

prog.cc:2:57: error: incremented enumerator value 9223372036854775808 is not representable in the largest integer type [-Werror,-Wenum-too-large]
enum E { x = std::numeric_limits::max(), y };
^
1 error generated.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@wheatman wheatman linked a pull request Jan 19, 2024 that will close this issue
wheatman added a commit to wheatman/llvm-project that referenced this issue Jan 19, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Jan 23, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Jan 27, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Jan 27, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Feb 18, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

In the Process also implements N3029 Improved Normal Enumerations and N3030
Enhancements to Enumerations which brings C enums more inline with C++
enums.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Feb 25, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

In the Process also implements N3029 Improved Normal Enumerations and N3030
Enhancements to Enumerations which brings C enums more inline with C++
enums.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Mar 20, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

In the Process also implements N3029 Improved Normal Enumerations and N3030
Enhancements to Enumerations which brings C enums more inline with C++
enums.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Mar 20, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

In the process also implements N3029 Improved Normal Enumerations and patially implements N3030
Enhancements to Enumerations which brings C enums more inline with C++ enums.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Mar 21, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

In the process also implements N3029 Improved Normal Enumerations and
patially implements N3030 Enhancements to Enumerations which brings C enums
more inline with C++ enums.

Fixes llvm#24667
wheatman added a commit to wheatman/llvm-project that referenced this issue Mar 21, 2024
Enums which do not have a specified type can only grow to bigger types
which contain more bits than the prior types.  This means that the
largest signed integer type cannot grow to the largest unsigned integer types.

In the process also implements N3029 Improved Normal Enumerations and
patially implements N3030 Enhancements to Enumerations which brings C enums
more inline with C++ enums.

Fixes llvm#24667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0 participants