https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102680

            Bug ID: 102680
           Summary: lambda-expression in template-argument plus templateed
                    using leads to further using-directive being ignored
                    within template scope
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hq.ks at web dot de
  Target Milestone: ---

Created attachment 51581
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51581&action=edit
minimalist reproducer

Take:
0) a class template with two arguments
1) a templated using-directive containing a lambda-expression as a template
parameter to (0)
2) a using declaration within another template scope, which depends on template
parameters and makes use of (1)
3) any use of the type alias defined by (2)

With GCC 9.4.0, from my observation, the behavior is identical to the using
directive (2) not being there at all: it will complain about the alias not
naming a type, and if a conflicting definition of the same type is added, it
will accept it. (It will parse the RHS of (2) for errors, though.)

-Wall -Wextra does not turn up any warnings.

Generally, I would expect exactly one of the following to happen:
a) (2) gives a compiler error
b) Below (2), and in its scope, the alias is usable as a type name. 

I am not a C++ language lawyer, so I can't really vouch that my reproducer is
in fact valid C++20, but even if it is not, the principle of least surprise
would imply raising an error at (2). 

Cheers,
   Philipp

 > g++ --version # compiled from tarball
g++ (GCC) 9.4.0

 > uname -a
Linux hostname 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64
GNU/Linux

Reply via email to