Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 15946
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Jason Merrill <jason@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Paul Koning <pkoning@equallogic.com>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 15946 depends on: Show dependency tree
Show dependency graph
Bug 15946 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2009-11-08 04:03 Opened: 2004-06-11 17:17
Consider this test case:

template <class T> class Foo
{
public:
    typedef T bar;
    int x;
    T z;
};
template <class T> class Test: public Foo<T>
{
public:
    typedef T * t2;
    typedef Foo<T> F;
    
    t2 t;
    F f;
    typename F::bar b;
    typename Foo<T>::bar b2;
    F::bar b3;
    Foo<T>::bar b4;
};

Test<int> T2;

GCC 3.3.3 complains about the declarations of b3 and b4, saying that it's an
implicit typename and that's deprecated.

GCC 3.4.0 rejects the code outright.  Given that it's the next version, and it
was deprecated, that's ok.  What's not ok is the error message:

foo.cc:18: error: expected `;' before "b3"
foo.cc:19: error: expected `;' before "b4"

This gives no clue at all about what the problem is or how to correct it.

------- Comment #1 From Andrew Pinski 2004-06-11 17:26 -------
Confirmed.

------- Comment #2 From Andrew Pinski 2004-11-12 14:11 -------
*** Bug 18451 has been marked as a duplicate of this bug. ***

------- Comment #3 From Andrew Pinski 2008-05-28 08:00 -------
*** Bug 36353 has been marked as a duplicate of this bug. ***

------- Comment #4 From Andrew Pinski 2009-10-14 04:08 -------
*** Bug 40738 has been marked as a duplicate of this bug. ***

------- Comment #5 From Jason Merrill 2009-11-06 21:18 -------
Subject: Bug 15946

Author: jason
Date: Fri Nov  6 21:18:42 2009
New Revision: 153978

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153978
Log:
        PR c++/15946
        * parser.c (cp_parser_check_template_parameters): Don't talk about
        specialization at function scope.
        (cp_parser_diagnose_invalid_type_name): Handle dependent scope.
        (cp_parser_parse_and_diagnose_invalid_type_name): Likewise.
        (cp_parser_expression_statement): Suggest typename.
        * error.c (dump_decl) [SCOPE_REF]: Print the type here.
        (dump_expr) [SCOPE_REF]: Call it.
        (dump_type) [UNBOUND_CLASS_TEMPLATE]: Check TFF_UNQUALIFIED_NAME.
        * cxx-pretty-print.c (pp_cxx_unqualified_id): Print class template
        args.

Added:
    trunk/gcc/testsuite/g++.dg/parse/error36.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cxx-pretty-print.c
    trunk/gcc/cp/error.c
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/template/error26.C
    trunk/gcc/testsuite/g++.old-deja/g++.other/typename1.C

------- Comment #6 From Jason Merrill 2009-11-08 03:10 -------
*** Bug 35228 has been marked as a duplicate of this bug. ***

------- Comment #7 From Jason Merrill 2009-11-08 04:02 -------
*** Bug 15179 has been marked as a duplicate of this bug. ***

------- Comment #8 From Jason Merrill 2009-11-08 04:03 -------
Fixed for 4.5.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug