diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2023-03-13 22:39:59 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2023-03-13 22:39:59 +0000 |
commit | 0c56f3557eeeee24ce438c78e35439dada5f5001 (patch) | |
tree | e70b9848df5cf55d99bbd150f82b82fedbd0b2e7 /Examples/test-suite/errors/cpp_nested_template.stderr | |
parent | 7c043d4713a60bae693f9656d43222e842f9b61f (diff) | |
download | swig-0c56f3557eeeee24ce438c78e35439dada5f5001.tar.gz |
Improved error checking when defining classes and using %template.
1. When a template is instantiated via %template and uses the unary scope
operator ::, an error occurs if the instantiation is attempted within a
namespace that does not enclose the instantiated template.
For example, the following will now error as ::test::max is not enclosed within test1:
Error: '::test::max' resolves to 'test::max' and was incorrectly instantiated in
scope 'test1' instead of within scope 'test'.
namespace test1 {
%template(maxchar) ::test::max<char>;
}
2. SWIG previously failed to always detect a template did not exist when using
%template. In particular when instantiating a global template incorrectly within
namespace. The code below now correctly emits an error:
Error: Template 'test5::GlobalVector' undefined.
namespace test5 {
}
template<typename T> struct GlobalVector {};
%template(GVI) test5::GlobalVector<int>;
3. Also error out if an attempt is made to define a class using the unary scope
operator ::. The following is not legal C++ and now results in an error:
Error: Using the unary scope operator :: in class definition '::Space2::B' is invalid.
namespace Space2 {
struct B;
}
struct ::Space2::B {};
Diffstat (limited to 'Examples/test-suite/errors/cpp_nested_template.stderr')
-rw-r--r-- | Examples/test-suite/errors/cpp_nested_template.stderr | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/Examples/test-suite/errors/cpp_nested_template.stderr b/Examples/test-suite/errors/cpp_nested_template.stderr index 363a260f6..5b107cad4 100644 --- a/Examples/test-suite/errors/cpp_nested_template.stderr +++ b/Examples/test-suite/errors/cpp_nested_template.stderr @@ -1,4 +1,2 @@ cpp_nested_template.i:9: Error: 'Temply' resolves to '::Temply' and was incorrectly instantiated in scope 'A' instead of within scope ''. -cpp_nested_template.i:9: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template(). cpp_nested_template.i:18: Error: 'Temply' resolves to '::Temply' and was incorrectly instantiated in scope 'B' instead of within scope ''. -cpp_nested_template.i:18: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template(). |