<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 10, 2020, at 6:36 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div dir="ltr" class="">On Fri, 10 Jul 2020 at 15:09, David Rector via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="overflow-wrap: break-word;" class=""><div class=""><div class="">...</div><div class="">Note you’ll also need an UnresolvedUsingEnumDecl for e.g. "using enum T::someenum" when T is dependent; in TreeTransfomr::… you may transform that to your UsingEnumDecl when T becomes non-dependent; follow the example of e.g. UnresolvedUsingTypenameDecl I believe it is.</div></div></div></blockquote><div class=""><br class=""></div><div class="">We don't need that in this case, because the language rules don't permit `using enum A::B;` to name a dependent type. (The reason it's disallowed is that it would create major implementation problems -- we couldn't reasonably do unqualified lookups in a scope that contains such a declaration because we'd have no idea if the name resolves to an enumerator.)</div></div></div></div></blockquote><br class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="-webkit-font-kerning: none;" class="">Is that rule really necessary though?  Why not allow the dependent enum itself and let lookup fail for the enumerators, just until it finally is transformed into a resolved UsingEnumDecl?  E.g.:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><span style="-webkit-font-kerning: none;" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="-webkit-font-kerning: none;" class="">```</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">enum class fruit  { orange, apple };</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">enum class fruitB { orange, apple, pear };</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo; min-height: 11px;" class=""><span style="-webkit-font-kerning: none;" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">template<typename FRUIT_IMPL></span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">struct S {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">  using enum FRUIT_IMPL; //why does this need to be an error?</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">  static const auto BadVal = orange; //Definitely an error, undeclared ID "orange"; shouldn’t this suffice?</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">  static const auto GoodVal = </span>FRUIT_IMPL::orange; // This should be okay though, since still dependent.</div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">};</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo; min-height: 11px;" class=""><span style="-webkit-font-kerning: none;" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">void f() {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">  S<fruit> s;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">  s.orange;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo; min-height: 11px;" class=""><span style="-webkit-font-kerning: none;" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">  S<fruitB> s2;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">  s2.pear;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;" class=""><span style="-webkit-font-kerning: none;" class="">}</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="-webkit-font-kerning: none;" class="">```</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><span style="-webkit-font-kerning: none;" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="-webkit-font-kerning: none;" class="">I couldn’t find an explanation on the page Shachaf referenced.  In any case, if there is no need to handle a dependent case this should be very straightforward, Shachaf.  Good luck,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><span style="-webkit-font-kerning: none;" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="-webkit-font-kerning: none;" class="">- Dave</span></div></div><br class=""></body></html>