https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86403
Jonathan Poelen <jonathan.poelen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jonathan.poelen at gmail dot
com
--- Comment #2 from Jonathan Poelen <jonathan.poelen at gmail dot com> ---
$ g++ --version
g++ (GCC) 9.2.0
$ cat test.cpp
struct A
{
template<class T>
struct B
{
B(T) {}
};
template<class T>
B(T) -> B<T>;
};
$ g++ -std=c++17 test.cpp
test.cpp:10:3: error: deduction guide ‘A::B(T) -> A::B<T>’ must be declared at
namespace scope
10 | B(T) -> B<T>;
| ^
This works with Clang and MSVC.
https://en.cppreference.com/w/cpp/language/class_template_argument_deduction#User-defined_deduction_guides
User-defined deduction guides must name a class template and must be introduced
within the same semantic scope of the class template (which could be namespace
or ****enclosing class****)