public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54948] New: template unnecessarily displayed as "A< template-parameter-1-1 >" not "A<T>"
@ 2012-10-17 13:25 redi at gcc dot gnu.org
  2013-04-20 12:03 ` [Bug c++/54948] " manu at gcc dot gnu.org
  2022-01-18 13:24 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-17 13:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54948

             Bug #: 54948
           Summary: template unnecessarily displayed as "A<
                    template-parameter-1-1 >" not "A<T>"
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


template<typename> struct A;

template<typename T> struct A { A(Y); };

A<int> a;

This invalid code produces:

tp.cc: In instantiation of 'struct A<int>':
tp.cc:5:8:   required from here
tp.cc:3:36: error: 'A< <template-parameter-1-1> >::Y' has incomplete type
 template<typename T> struct A { A(Y); };
                                    ^
tp.cc:3:29: error: declaration of 'struct A<int>'
 template<typename T> struct A { A(Y); };
                             ^

This is correct, but "A< <template-parameter-1-1> >::Y" is rather ugly.

At the point of the error the parameter has a name, so "A<T>::Y" could be shown
instead.


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

* [Bug c++/54948] template unnecessarily displayed as "A< template-parameter-1-1 >" not "A<T>"
  2012-10-17 13:25 [Bug c++/54948] New: template unnecessarily displayed as "A< template-parameter-1-1 >" not "A<T>" redi at gcc dot gnu.org
@ 2013-04-20 12:03 ` manu at gcc dot gnu.org
  2022-01-18 13:24 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2013-04-20 12:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54948

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-04-20 12:03:29 UTC ---
There are several "bugs" in this case. The first one is that we consider that
the type of:

template<typename> struct A

is "struct A< <template-parameter-1-1> >". It would be nicer to print something
like "struct A<typename>" or "struct A<>". Clang never needs to print made up
names.

The second bug is that I think we record T when parsing, but later we drop it.
I wasn't able to find when we drop it. There is a lot going on between the
moment we parse T and the moment we parse {, so it is rather difficult to
figure out. Stepping in the parser is rather frustrating.

I am afraid that the only person that may know what is going or where to look
is Jason. There is lookup_template_class, but by the time we call it, we
already dropped T (or so it seems to me, maybe it is recorded somewhere else).
>From gcc-bugs-return-420647-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Apr 20 12:06:13 2013
Return-Path: <gcc-bugs-return-420647-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8678 invoked by alias); 20 Apr 2013 12:06:13 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 8633 invoked by uid 48); 20 Apr 2013 12:06:10 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54948] template unnecessarily displayed as "A< template-parameter-1-1 >" not "A<T>"
Date: Sat, 20 Apr 2013 12:06:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-54948-4-YeetVUoGo8@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-54948-4@http.gcc.gnu.org/bugzilla/>
References: <bug-54948-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01792.txt.bz2
Content-length: 300


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54948

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-04-20 12:06:10 UTC ---
BTW, the parser may benefit by marking some functions with "skip" to help
debugging. All the cp_lexer_peek_* are useless to step into.
>From gcc-bugs-return-420648-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Apr 20 12:28:35 2013
Return-Path: <gcc-bugs-return-420648-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17843 invoked by alias); 20 Apr 2013 12:28:35 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17816 invoked by uid 48); 20 Apr 2013 12:28:31 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57012] New: pretty-printer does not handle well template parameter packs
Date: Sat, 20 Apr 2013 12:28:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57012-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01793.txt.bz2
Content-length: 1768


http://gcc.gnu.org/bugzilla/show_bug.cgi?idW012

             Bug #: 57012
           Summary: pretty-printer does not handle well template parameter
                    packs
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: manu@gcc.gnu.org


/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:2:40: error:
parameter pack '<template-parameter-1-1>' must be at the end of the template
parameter list
/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:7:11: error:
type/value mismatch at argument 1 in template parameter list for
'template<<declaration error>, class> struct A'
/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:7:11: error:
expected a constant of type '<type error>', got 'int'
/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:7:14: error:
invalid type in declaration before ';' token
/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:8:11: error:
type/value mismatch at argument 1 in template parameter list for
'template<<declaration error>, class> struct A'
/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:8:11: error:
expected a constant of type '<type error>', got 'char'
/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:8:14: error:
invalid type in declaration before ';' token

Clang++ by comparison:

/home/manuel/test3/src/gcc/testsuite/g++.dg/cpp0x/pr31432.C:2:10: error:
template parameter pack must be the last template parameter
template<typename..., typename> struct A // { dg-error "parameter pack" }
         ^


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

* [Bug c++/54948] template unnecessarily displayed as "A< template-parameter-1-1 >" not "A<T>"
  2012-10-17 13:25 [Bug c++/54948] New: template unnecessarily displayed as "A< template-parameter-1-1 >" not "A<T>" redi at gcc dot gnu.org
  2013-04-20 12:03 ` [Bug c++/54948] " manu at gcc dot gnu.org
@ 2022-01-18 13:24 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-18 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=104094

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This continues to be annoying. Libstdc++ has loads of forward declarations of
templates, e.g. in <type_traits>:

  // Forward declarations
  template<typename>
    struct is_reference;
  template<typename>
    struct is_function;
  template<typename>
    struct is_void;
  template<typename>
    struct remove_cv;
  template<typename>
    struct is_const;

Which means we then get diagnostics containing:

std::is_same<_U1, typename std::remove_cv< <template-parameter-1-1> >::type&>

I agree with Manu that this could just show "typename" here. We don't refer to
the template-parameter-1-1 type again in the diagnostic, so why do we care
about uniquely identifying it as 1-1?

But why is it even using the name from the remove_cv declaration? That should
not be appearing in the *use* of remove_cv here. I've filed that as PR 104094.

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

end of thread, other threads:[~2022-01-18 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-17 13:25 [Bug c++/54948] New: template unnecessarily displayed as "A< template-parameter-1-1 >" not "A<T>" redi at gcc dot gnu.org
2013-04-20 12:03 ` [Bug c++/54948] " manu at gcc dot gnu.org
2022-01-18 13:24 ` 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).