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

Reply via email to