llvm-project/clang/test/Parser/cxx20-using-enum.cpp
Nathan Sidwell 3d2080683f [clang][DR2621] using enum NAME lookup fix
Although using-enum's grammar is 'using elaborated-enum-specifier',
the lookup for the enum is ordinary lookup (and not the tagged-type
lookup that normally occurs wth an tagged-type specifier).  Thus (a)
we can find typedefs and (b) do not find enum tags hidden by a non-tag
name (the struct stat thing).

This reimplements that part of using-enum handling, to address DR2621,
where clang's behaviour does not match std intent (and other
compilers).

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D134283
2022-09-28 08:50:27 -07:00

13 lines
443 B
C++

// RUN: %clang_cc1 -std=c++20 -verify %s
namespace GH57347 {
namespace A {}
void f() {
using enum A::+; // expected-error {{using enum requires an enum or typedef name}}
using enum; // expected-error {{using enum requires an enum or typedef name}}
using enum class; // expected-error {{using enum requires an enum or typedef name}}
using enum enum q; // expected-error {{using enum does not permit an elaborated enum specifier}}
}
}