public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110686] New: problem with explicit
@ 2023-07-16 15:22 irip at qq dot com
  2023-07-17  7:29 ` [Bug c++/110686] " rguenth at gcc dot gnu.org
  2023-07-17  9:02 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: irip at qq dot com @ 2023-07-16 15:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110686
           Summary: problem with explicit
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: irip at qq dot com
  Target Milestone: ---

Test template name resolution, such as:

template <char k> struct N {
    template <char p> struct S23{
typedef long X;
void g(void) { try {} catch (typename ::N<k>::S<P>::S23<p>::X) {} }
};
};

Compiler error:
'typename N::S' names 'template template struct N::S', which is not a type
expected unqualified-id before '<' token
expected ')' before '<' token
expected '{' before '<' token
expected primary-expression before '<' token
'::X' has not been declared
expected '; ' before ')' token

Error occurs when using typename and nested namespace templates.
The C++ standard describes that the typename prefix should be used when a
nested form such as ::N<k>::S<P>::S23<p>::X represents a type rather than a
member of the currently instantiated template.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/110686] problem with explicit
  2023-07-16 15:22 [Bug c++/110686] New: problem with explicit irip at qq dot com
@ 2023-07-17  7:29 ` rguenth at gcc dot gnu.org
  2023-07-17  9:02 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-17  7:29 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
clang provides the maybe more helpful:

> clang++ t.C -S
t.C:4:47: error: no type named 'S' in 'N<k>'
void g(void) { try {} catch (typename ::N<k>::S<P>::S23<p>::X) {} }
                             ~~~~~~~~~~~~~~~~~^

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/110686] problem with explicit
  2023-07-16 15:22 [Bug c++/110686] New: problem with explicit irip at qq dot com
  2023-07-17  7:29 ` [Bug c++/110686] " rguenth at gcc dot gnu.org
@ 2023-07-17  9:02 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-07-17  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to actri_lxlong3 from comment #0)
> Test template name resolution, such as:
> 
> template <char k> struct N {
>     template <char p> struct S23{
> typedef long X;
> void g(void) { try {} catch (typename ::N<k>::S<P>::S23<p>::X) {} }

This code is nonsense, why are you reporting this?

> Error occurs when using typename and nested namespace templates.
> The C++ standard describes that the typename prefix should be used when a
> nested form such as ::N<k>::S<P>::S23<p>::X represents a type rather than a
> member of the currently instantiated template.

Yes, but it also says that you need to say ::template S<P> and ::template
S23<p> but that still won't help because P and S are not declared anywhere.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-17  9:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-16 15:22 [Bug c++/110686] New: problem with explicit irip at qq dot com
2023-07-17  7:29 ` [Bug c++/110686] " rguenth at gcc dot gnu.org
2023-07-17  9:02 ` redi at gcc dot gnu.org

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).