public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16233] New: Bad diagnostic
@ 2004-06-27 17:25 igodard at pacbell dot net
  2004-06-27 17:48 ` [Bug c++/16233] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: igodard at pacbell dot net @ 2004-06-27 17:25 UTC (permalink / raw)
  To: gcc-bugs

template<typename T> struct A {
    template<typename U> void Foo(){} };
template<typename V>struct B {
    void Bar(V* v) {
        v->template Foo<int>();
        v->Foo<int>();
        }
    };
int main() {
    A<bool> a;
    B<A<bool> > b;
    b.Bar(&a);
    }

gets you:

~/ootbc/common/test/src$ g++ foo.cc
foo.cc: In member function `void B<V>::Bar(V*)':
foo.cc:6: error: expected primary-expression before "int"
foo.cc:6: error: expected `;' before "int"

The actual problem is the missing explicit "template" qualification. Surely the compiler can recognize "<int>" as a template argument list in this case. I grant that templates with data elements cannot be recognized in such a context:

-- 
           Summary: Bad diagnostic
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-06-27 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-27 17:25 [Bug c++/16233] New: Bad diagnostic igodard at pacbell dot net
2004-06-27 17:48 ` [Bug c++/16233] " pinskia at gcc dot gnu dot org
2004-06-27 17:53 ` pinskia at gcc dot gnu dot org
2004-06-27 17:55 ` [Bug c++/16233] unhelpful error message when "template" is omitted pinskia at gcc dot gnu dot org
2004-06-27 18:09 ` pinskia 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).