Issue 84712
Summary [clang] Invalid rejection of enum arithmetic
Labels clang
Assignees
Reporter davidstone
    The following valid translation unit

```cpp
enum e1 {
	value = 0
};

enum e2 {
	a = 0,
	b = e1::value,
	c = a + b
};
```

is incorrectly rejected by clang when compiled in C++26 mode with

```console
<source>:8:8: error: invalid arithmetic between different enumeration types ('e2' and 'e1')
    8 |         c = a + b
      |             ~ ^ ~
1 error generated.
Compiler returned: 1
```

See it live: https://godbolt.org/z/v4sG9YqMb

In earlier versions of C++, it incorrectly warns saying the conversion is deprecated.

This was accepted in clang 18.1.0, but is failing on current trunk (15e9478187d594016c2c355d8688be2e0a9b554e).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to