https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87452
Bug ID: 87452 Summary: decltype ignores namespace in trailing return type Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: schuchart at hlrs dot de Target Milestone: --- Created attachment 44758 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44758&action=edit Test case It appears that GCC does not include the namespace in the evaluations of expressions passed to decltype() in trailing return type definitions. The attached test-case compiled with GCC 8.2.0 produces the following output: $ g++-8 gcc_decltype_ret.cc $ ./a.out 10 fall-back $ g++-8 --version g++-8 (Ubuntu 8.2.0-1ubuntu2~18.04) 8.2.0 ]] Compiling with Clang 6.0.1 on the other hand gives the following output: $ clang++-6.0 gcc_decltype_ret.cc $ ./a.out 10 0 0 0 0 0 0 0 0 0 0 In other parts of the code, the same decltype() statement that is used in the trailing return type definition yields the expected type (line 26).