[llvm-bugs] [Bug 45026] improve diagnostic for dependent using-declaration that was intended to inherit constructors but used invalid syntax

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 28 15:43:45 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=45026

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Incorrect "dependent using  |improve diagnostic for
                   |declaration resolved to     |dependent using-declaration
                   |type without 'typename'"    |that was intended to
                   |error                       |inherit constructors but
                   |                            |used invalid syntax
         Resolution|INVALID                     |---
             Status|RESOLVED                    |REOPENED

--- Comment #3 from Richard Smith <richard-llvm at metafoo.co.uk> ---
> 1) If I should always do it in this form, why clang still accepts past syntax in a lot of cases and breaks only with such complicated case, seems to be very confusing.

Per the above link, the language restriction only applies "when the
nested-name-specifier is dependent", which is to say when the part before the
final '::' involves a template parameter in some way.

Nonetheless it's good practice to always write the same name before and after
the '::', even though sometimes other syntaxes are sometimes valid.

> 2) Error message is not clear at all.

This is a fair point; it would be feasible to add a note to the diagnostic:

note: use the same name before and after the '::' to inherit constructors from
'ParentContainer<int>::NestedClass'
    using parent_t::NestedClass;
                    ^~~~~~~~~~~
                    parent_t

Reopening to track the possible diagnostic improvement.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200228/8c69cbb4/attachment-0001.html>


More information about the llvm-bugs mailing list