Commit 2609a398 by Paolo Carlini Committed by Paolo Carlini

re PR c++/52688 (static local variable can accessed from local class of function template)

2013-03-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/52688
	* g++.dg/template/static33.C: New.
	* g++.dg/template/static34.C: Likewise.

	PR c++/10291
	* g++.dg/template/static35.C: New.

From-SVN: r196405
parent 9eb24748
2013-03-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/52688
* g++.dg/template/static33.C: New.
* g++.dg/template/static34.C: Likewise.
PR c++/10291
* g++.dg/template/static35.C: New.
2013-03-01 Steve Ellcey <sellcey@mips.com>
* gcc.dg/pr56396.c: Require pic support.
......
// PR c++/52688
// { dg-do link }
template<typename T>
T f()
{
static const double staticLocalVariable = 100.0;
struct local
{
static double f() { return staticLocalVariable; }
};
return T(local::f());
}
int main()
{
f<double>();
}
// PR c++/52688
// { dg-do link }
template<class T>
struct A {
static bool test() {
static bool value = false;
if (value)
return false;
struct S {
S() { value = true; }
};
static S s;
return true;
}
};
int main()
{
A<int>::test();
}
// PR c++/10291
// { dg-do link }
template <class T>
int foo ()
{
static int i;
struct S {
int bar () {
return i;
}
} s;
return s.bar ();
}
int main ()
{
foo<int>();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment