public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102002] New: spec requires typename can be dropped when used as template function return type consisting of template parameter which is at global scope
@ 2021-08-20 15:33 nickhuang99 at hotmail dot com
2021-08-20 15:54 ` [Bug c++/102002] " mpolacek at gcc dot gnu.org
2021-08-21 0:51 ` nickhuang99 at hotmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: nickhuang99 at hotmail dot com @ 2021-08-20 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102002
Bug ID: 102002
Summary: spec requires typename can be dropped when used as
template function return type consisting of template
parameter which is at global scope
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nickhuang99 at hotmail dot com
Target Milestone: ---
Spec considers *typename* can be dropped when there is no ambiguous of
regarding identifier as type. And
example(https://timsong-cpp.github.io/cppwp/temp.res#general-example-5) shows
this OK.
template<class T> T::R f();//OK, return type of a function declaration at
global scope
However, all compilers including GCC, clang, MSVC++ complains missing typename
because
error: need ‘typename’ before ‘T::R’ because ‘T’ is a dependent scope
1 | template<class T> T::R f();
| ^
| typename
Here I quote spec(https://timsong-cpp.github.io/cppwp/temp.res#general-4.1):
A qualified or unqualified name is said to be in a type-only context if it
is the terminal name of
a typename-specifier, nested-name-specifier, elaborated-type-specifier,
class-or-decltype
...
I understand this relaxation of enforcing *typename* is not so critical. Still
it is nice to strictly follow spec.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/102002] spec requires typename can be dropped when used as template function return type consisting of template parameter which is at global scope
2021-08-20 15:33 [Bug c++/102002] New: spec requires typename can be dropped when used as template function return type consisting of template parameter which is at global scope nickhuang99 at hotmail dot com
@ 2021-08-20 15:54 ` mpolacek at gcc dot gnu.org
2021-08-21 0:51 ` nickhuang99 at hotmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-08-20 15:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102002
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |WORKSFORME
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
You need to use -std=c++20.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/102002] spec requires typename can be dropped when used as template function return type consisting of template parameter which is at global scope
2021-08-20 15:33 [Bug c++/102002] New: spec requires typename can be dropped when used as template function return type consisting of template parameter which is at global scope nickhuang99 at hotmail dot com
2021-08-20 15:54 ` [Bug c++/102002] " mpolacek at gcc dot gnu.org
@ 2021-08-21 0:51 ` nickhuang99 at hotmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: nickhuang99 at hotmail dot com @ 2021-08-21 0:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102002
--- Comment #2 from qingzhe huang <nickhuang99 at hotmail dot com> ---
Thank you and my apology.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-21 0:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 15:33 [Bug c++/102002] New: spec requires typename can be dropped when used as template function return type consisting of template parameter which is at global scope nickhuang99 at hotmail dot com
2021-08-20 15:54 ` [Bug c++/102002] " mpolacek at gcc dot gnu.org
2021-08-21 0:51 ` nickhuang99 at hotmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).