public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28211]  New: wrong linkage of template argument, diagnostic could be improved
@ 2006-06-30 18:27 fang at csl dot cornell dot edu
  2006-06-30 18:34 ` [Bug c++/28211] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: fang at csl dot cornell dot edu @ 2006-06-30 18:27 UTC (permalink / raw)
  To: gcc-bugs

Description: Error message on invalid code could be clearer.  Test case code is
invalid because the linkage of the template argument is wrong (needs to be
extern).  

testcase.cc (reduced from case by Ladd Van Tol <ladd AT criticalpath DOT com>,
on xcode-users AT lists DOT apple DOT com):
template <const int*> class Helper { };
// extern const int foo;
const int foo = 0;
typedef Helper<&foo> HelperType;

Command: g++ -c testcase.cc

Output (g++ 4.0.1):
testcase.cc:4: error: missing '>' to terminate the template argument list
testcase.cc:4: error: template argument 1 is invalid
testcase.cc:4: error: expected initializer before '>' token

Output (g++ 4.2.0 20060610)
testcase.cc:4: error: template argument 1 is invalid
testcase.cc:4: error: invalid type in declaration before ';' token

Remark: uncommenting the extern declaration make the case valid

Keyword: diagnostic
Severity: minor

Suggestion: "template argument 1 is invalid because symbol does not have
external linkage"


-- 
           Summary: wrong linkage of template argument, diagnostic could be
                    improved
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fang at csl dot cornell dot edu


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


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

* [Bug c++/28211] wrong linkage of template argument, diagnostic could be improved
  2006-06-30 18:27 [Bug c++/28211] New: wrong linkage of template argument, diagnostic could be improved fang at csl dot cornell dot edu
@ 2006-06-30 18:34 ` pinskia at gcc dot gnu dot org
  2006-09-18  0:48 ` [Bug c++/28211] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-30 18:34 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
           Keywords|                            |diagnostic


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


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

* [Bug c++/28211] [4.0/4.1/4.2 Regression] wrong linkage of template argument, diagnostic could be improved
  2006-06-30 18:27 [Bug c++/28211] New: wrong linkage of template argument, diagnostic could be improved fang at csl dot cornell dot edu
  2006-06-30 18:34 ` [Bug c++/28211] " pinskia at gcc dot gnu dot org
@ 2006-09-18  0:48 ` pinskia at gcc dot gnu dot org
  2006-09-20 22:24 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18  0:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-09-18 00:48 -------
Confirmed, a regression from 3.3.3 which gave:
t.cc:4: error: address of non-extern `foo' cannot be used as template argument


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |3.4.0 4.0.0 4.1.0 4.2.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-18 00:48:45
               date|                            |
            Summary|wrong linkage of template   |[4.0/4.1/4.2 Regression]
                   |argument, diagnostic could  |wrong linkage of template
                   |be improved                 |argument, diagnostic could
                   |                            |be improved
   Target Milestone|---                         |4.0.4


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


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

* [Bug c++/28211] [4.0/4.1/4.2 Regression] wrong linkage of template argument, diagnostic could be improved
  2006-06-30 18:27 [Bug c++/28211] New: wrong linkage of template argument, diagnostic could be improved fang at csl dot cornell dot edu
  2006-06-30 18:34 ` [Bug c++/28211] " pinskia at gcc dot gnu dot org
  2006-09-18  0:48 ` [Bug c++/28211] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-09-20 22:24 ` mmitchel at gcc dot gnu dot org
  2006-10-15 22:41 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-09-20 22:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/28211] [4.0/4.1/4.2 Regression] wrong linkage of template argument, diagnostic could be improved
  2006-06-30 18:27 [Bug c++/28211] New: wrong linkage of template argument, diagnostic could be improved fang at csl dot cornell dot edu
                   ` (2 preceding siblings ...)
  2006-09-20 22:24 ` mmitchel at gcc dot gnu dot org
@ 2006-10-15 22:41 ` mmitchel at gcc dot gnu dot org
  2006-10-16 17:02 ` mmitchel at gcc dot gnu dot org
  2006-10-16 17:17 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-15 22:41 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/28211] [4.0/4.1/4.2 Regression] wrong linkage of template argument, diagnostic could be improved
  2006-06-30 18:27 [Bug c++/28211] New: wrong linkage of template argument, diagnostic could be improved fang at csl dot cornell dot edu
                   ` (3 preceding siblings ...)
  2006-10-15 22:41 ` mmitchel at gcc dot gnu dot org
@ 2006-10-16 17:02 ` mmitchel at gcc dot gnu dot org
  2006-10-16 17:17 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-16 17:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mmitchel at gcc dot gnu dot org  2006-10-16 17:02 -------
Subject: Bug 28211

Author: mmitchel
Date: Mon Oct 16 17:02:07 2006
New Revision: 117787

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117787
Log:
        PR c++/28211
        * parser.c (cp_parser_template_argument): Don't consider "&var" a
        possible constant-expression.
        * pt.c (convert_nontype_argument): Refine handling of arguments of
        pointer type.
        PR c++/28211
        * g++.dg/tc1/dr49.C: Tweak error messages.
        * g++.dg/parse/template21.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/template21.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/tc1/dr49.C


-- 


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


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

* [Bug c++/28211] [4.0/4.1/4.2 Regression] wrong linkage of template argument, diagnostic could be improved
  2006-06-30 18:27 [Bug c++/28211] New: wrong linkage of template argument, diagnostic could be improved fang at csl dot cornell dot edu
                   ` (4 preceding siblings ...)
  2006-10-16 17:02 ` mmitchel at gcc dot gnu dot org
@ 2006-10-16 17:17 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-16 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2006-10-16 17:17 -------
Fixed in 4.2.0.  Will not be fixed in previous releases.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2006-10-16 17:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30 18:27 [Bug c++/28211] New: wrong linkage of template argument, diagnostic could be improved fang at csl dot cornell dot edu
2006-06-30 18:34 ` [Bug c++/28211] " pinskia at gcc dot gnu dot org
2006-09-18  0:48 ` [Bug c++/28211] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-09-20 22:24 ` mmitchel at gcc dot gnu dot org
2006-10-15 22:41 ` mmitchel at gcc dot gnu dot org
2006-10-16 17:02 ` mmitchel at gcc dot gnu dot org
2006-10-16 17:17 ` mmitchel at gcc dot gnu dot 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).