PATCH C++: speed up templates
Ziemowit Laski
zlaski@apple.com
Fri Feb 21 02:07:00 GMT 2003
On Thursday, Feb 20, 2003, at 10:53 US/Pacific, Mark Mitchell wrote:
> --On Thursday, February 20, 2003 10:49:28 AM -0800 Matt Austern
> <austern@apple.com> wrote:
>
>> Giving a friendlier diagnostic for incorrect code, at the cost of
>> being
>> slower when compiling correct programs, isn't obviously a good
>> tradeoff.
>
> It's not a friendlier diagnostic -- the compiler now *terminates*.
>
> Running forever is pretty unfriendly.
Well... I'm having difficulty reproducing the infinite loop which your
patch purports to fix!
I checked out the sources as of 2002-11-08T01:00-0000, i.e., right
_before_ your patch went in, and built the compiler.
Then, I tried compiling your crash2.C test case with it, expecting the
compiler to hang. No such luck (see below).
This is all under RedHat Linux 8.0.
So, can you point me to a date or release tag where the bug is
reproducible?
Thanks,
--Zem
========================================================================
=======
zlaski@johada4:tests> cat mark.templ.crash2.C
// { dg-options "" }
template <class EnumType>
class A
{
public:
static const EnumType size = max; // { dg-error "" }
int table[size];
};
template <class EnumType>
const EnumType A<EnumType>::size;
namespace N
{
enum E { max = 5 };
struct B
{
A<E> a; // { dg-error "" }
};
}
int
main()
{
N::B b;
return 0;
}
zlaski@johada4:tests> gcc_r 2002.11.08.01.00.00 g++ -c
mark.templ.crash2.C
+ /home/zlaski/fsf/dst/gcc/2002.11.08.01.00.00/bin/g++ -c
mark.templ.crash2.C
mark.templ.crash2.C: In instantiation of `A<N::E>':
mark.templ.crash2.C:20: instantiated from here
mark.templ.crash2.C:7: error: `max' was not declared in this scope
real 0m0.021s
user 0m0.014s
sys 0m0.008s
+ exit 1
--------------------------------------------------------------
Ziemowit Laski 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group Cupertino, CA USA 95014-2083
Apple Computer, Inc. +1.408.974.6229 Fax .5477
More information about the Gcc-patches
mailing list