Issue 52856
Summary Using an enum constant brought into scope using a `using enum` statement within a compound _expression_ causes a segfault
Labels new issue
Assignees
Reporter Qix-
    Relevant Godbolt: https://godbolt.org/z/9cqnvTG3q

The following snippet fails to compile:

```c++
//namespace Bar { // fixes everything
struct Bar {
	enum Foo {
		A = 1,
		B = 2,
		C = 4
	};
};

using B = Bar;

int main() {
    using enum B::Foo;

    // Using individual `using`
    // statements per-constant
    // doesn't make any difference,
    // except when lowering from
    // -std=c++20 to -std=c++17, which
    // compiles fine.
	//using B::Foo::A;
    //using B::Foo::B;

	int f = (A|B); // segfault
    //int f = (A); // weird error
    //int f = A|B; // OK
}
```

Uncommenting the various marked lines will demonstrate a few different strange failure cases.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to