c++/6772: Template-qualified default argument gives parse error

jsberg@bnl.gov jsberg@bnl.gov
Wed May 22 11:36:00 GMT 2002


>Number:         6772
>Category:       c++
>Synopsis:       Template-qualified default argument gives parse error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed May 22 11:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1
>Organization:
>Environment:
System: Linux jsberg1 2.4.18 #1 SMP Fri May 17 19:53:05 EDT 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.1/configure --prefix=/opt/gcc-3.1 --enable-threads
>Description:
If test01.cc is the code given below in How-To-Repeat, then
c++ -Wall -ansi -pedantic -c test01.cc
test01.cc:9: type specifier omitted for parameter `M'
test01.cc:9: parse error before `>' token
	
>How-To-Repeat:
c++ -Wall -ansi -pedantic -c test01.cc

template<typename T, int N> class A {
public:
  static const int i=1;
};

template<typename T, int M> class B {
public:
  void f(int j=A<T,M>::i);
};
	
>Fix:
Workaround: insert parentheses around A<T,M>::i or A<T,M>
	
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list