Bug 100084 - using enum lookup isn't type-only
Summary: using enum lookup isn't type-only
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, rejects-valid
: 103824 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-14 18:03 UTC by Barry Revzin
Modified: 2021-12-24 21:27 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-04-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barry Revzin 2021-04-14 18:03:43 UTC
From Stack Avarflaw (https://stackoverflow.com/q/67096550/2069064):

namespace A { enum A {}; };
using namespace A;
using enum A;

gcc trunk rejects this lookup as ambiguous, between the namespace A and the enum A. But our lookup in this context should be type-only, so the namespace A should not a candidate.
Comment 1 Barry Revzin 2021-04-14 18:12:06 UTC
Also gcc accepts:

namespace A { enum A {}; };
using namespace A;
using enum A::A;

Which, apparently, this one should actually be ambiguous.
Comment 2 Marek Polacek 2021-04-14 18:18:22 UTC
Confirmed.
Comment 3 康桓瑋 2021-04-15 05:22:09 UTC
Here is a weird case that I think should be accepted:

enum e { e };
using enum e;

gcc rejects with:

<source>:2:12: error: 'e' is not a type
    2 | using enum e;
      |            ^
Comment 4 Andrew Pinski 2021-12-24 21:27:48 UTC
*** Bug 103824 has been marked as a duplicate of this bug. ***