diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-03 17:10:37 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-03 17:10:37 +0000 |
commit | 580cd4a23ec4be39c765a245ed0cdc9e8c7799cd (patch) | |
tree | 2c378b3bb375600bf9df66d91ac3c48ca1cd2220 /clang/test/SemaTemplate/instantiate-static-var.cpp | |
parent | 5f498834881dd4c36eadf903359b81ce63f731c9 (diff) | |
download | bcm5719-llvm-580cd4a23ec4be39c765a245ed0cdc9e8c7799cd.tar.gz bcm5719-llvm-580cd4a23ec4be39c765a245ed0cdc9e8c7799cd.zip |
When we're building a CXXExprWithTemporaries, only include those
temporaries that are within our current evaluation context. That way,
nested evaluation contexts (e.g., within a sizeof() expression) won't
see temporaries from outer contexts. Also, make sure to push a new
evaluation context when instantiating the initializer of a variable;
this may be an unevaluated context or a potentially-evaluated context,
depending on whether it's an in-class initializer or not. Fixes PR5672.
llvm-svn: 90460
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-static-var.cpp')
-rw-r--r-- | clang/test/SemaTemplate/instantiate-static-var.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-static-var.cpp b/clang/test/SemaTemplate/instantiate-static-var.cpp index 452fccf2244..d4a7008b47b 100644 --- a/clang/test/SemaTemplate/instantiate-static-var.cpp +++ b/clang/test/SemaTemplate/instantiate-static-var.cpp @@ -72,3 +72,23 @@ void Test() { Z1<Y2<X2>::value> x2; int y2[Y2<X2>::value]; } + +// PR5672 +template <int n> +struct X3 {}; + +class Y3 { + public: + ~Y3(); // The error isn't triggered without this dtor. + + void Foo(X3<1>); +}; + +template <typename T> +struct SizeOf { + static const int value = sizeof(T); +}; + +void MyTest3() { + Y3().Foo(X3<SizeOf<char>::value>()); +} |