Details
-
Bug
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
4.2.x, 4.3.x, 5.0.0
-
None
-
$ uname -a; gcc -v 2>&1 | tail -n 1
Linux behemoth 2.6.37.6 #3 SMP Sat Apr 9 22:49:32 CDT 2011 x86_64 AMD Opteron(tm) Processor 6134 AuthenticAMD GNU/Linux
gcc version 4.7.1 (GCC)
-
Patch Available
-
Compiler Error
Description
Definitions of support template function occur after their use. The following test case fails:
$ cat test.cpp; gcc -c test.cpp template < class charT > void f () { g (charT ('a')); } template < class charT > void g (charT) { } int h () { return f< char > (), 0; } test.cpp: In instantiation of 'void f() \[with charT = char\]': test.cpp:14:23: required from here test.cpp:4:5: error: 'g' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation \[-fpermissive\] test.cpp:8:6: note: 'template<class charT> void g(charT)' declared here, later in the translation unit
The culprits are test_hash, test_weight_val, etc. Comeau and gcc fail, icc and SUNPro CC pass.