Add reduced test case for a common lookup failure. This is reduced from the standard library. The type mbstate_t is declared in the global scope and then incorporated into 'std' via using.
When the header doing this is converted into a PPH image, the lookup for identifier 'mbstate_t' produces the USING_DECL instead of the TYPE_DECL in the global scope. This causes the parser to segfault while parsing 'typedef std::mbstate_t state_type' in the user of that PPH image. Working on a fix shortly. 2012-03-20 Diego Novillo <dnovi...@google.com> * g++.dg/pph/x0mbstate_t.h: New. * g++.dg/pph/x1mbstate_t.h: New. diff --git a/gcc/testsuite/g++.dg/pph/x0mbstate_t.h b/gcc/testsuite/g++.dg/pph/x0mbstate_t.h new file mode 100644 index 0000000..dceb3e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/x0mbstate_t.h @@ -0,0 +1,10 @@ +#ifndef _X0_MBSTATE_T_H +#define _X0_MBSTATE_T_H + +typedef int mbstate_t; + +namespace std +{ + using ::mbstate_t; +} +#endif diff --git a/gcc/testsuite/g++.dg/pph/x1mbstate_t.h b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h new file mode 100644 index 0000000..c07a0cc --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h @@ -0,0 +1,9 @@ +// { dg-xfail-if "identifier bindings not set properly" { "*-*-*" } { "-fpph-map=pph.map"} } +// { dg-bogus ".*Segmentation fault" "ICE trying to parse std::mbstate_t" { xfail *-*-* } 0 } +#ifndef _X1_MBSTATE_H +#define _X1_MBSTATE_H +#include "x0mbstate_t.h" +// Name lookup for std::mbstate_t fails here. Instead of returning the global +// type_decl for mbstate_t, it returns the "usings ::mbstate_t" declaration. +typedef std::mbstate_t state_type; +#endif -- This patch is available for review at http://codereview.appspot.com/5844068