llvm-project/clang/test/SemaTemplate
Douglas Gregor b472e93af7 Implement appropriate semantics for C++ casting and conversion when
dealing with address-space- and GC-qualified pointers. Previously,
these qualifiers were being treated just like cvr-qualifiers (in some
cases) or were completely ignored, leading to uneven behavior. For
example, const_cast would allow conversion between pointers to
different address spaces.

The new semantics are fairly simple: reinterpret_cast can be used to
explicitly cast between pointers to different address spaces
(including adding/removing addresss spaces), while
static_cast/dynamic_cast/const_cast do not tolerate any changes in the
address space. C-style casts can add/remove/change address spaces
through the reinterpret_cast mechanism. Other non-CVR qualifiers
(e.g., Objective-C GC qualifiers) work similarly.

As part of this change, I tweaked the "casts away constness"
diagnostic to use the term "casts away qualifiers". The term
"constness" actually comes from the C++ standard, despite the fact
that removing "volatile" also falls under that category. In Clang, we
also have restrict, address spaces, ObjC GC attributes, etc., so the
more general "qualifiers" is clearer.

llvm-svn: 129583
2011-04-15 17:59:54 +00:00
..
ackermann.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
ambiguous-ovl-print.cpp Improve the reporting of non-viable overload candidates by noting the reason 2010-01-13 00:25:19 +00:00
anonymous-union.cpp When searching for an instantiated declaration requires instantiation 2010-11-05 23:22:45 +00:00
array-to-pointer-decay.cpp Apply array-to-pointer decay when instantiating a MemberExpr. Fixes 2010-06-22 02:41:05 +00:00
attributes.cpp Enhance the diagnostic for negative array sizes to include the 2011-01-04 04:44:35 +00:00
canonical-expr-type-0x.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
canonical-expr-type.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
class-template-ctor-initializer.cpp If a non-dependent base class initializer fails to match any direct or 2010-06-16 16:03:14 +00:00
class-template-decl.cpp Don't lose track of previous-declarations when instantiating a class template. 2010-11-08 23:29:42 +00:00
class-template-id-2.cpp When pretty-printing tag types, only print the tag if we're in C (and 2010-03-10 11:27:22 +00:00
class-template-id.cpp "const std::vector<int>*" not "std::vector<int> const*" 2010-09-05 00:27:00 +00:00
class-template-spec.cpp When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade the 2010-09-12 05:24:55 +00:00
constructor-template.cpp Improve our handling of C++ [class.copy]p3, which specifies that a 2010-11-08 17:16:59 +00:00
copy-ctor-assign.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
crash-8204126.cpp Don't set out-of-line template specialization/definition information 2010-07-28 23:59:57 +00:00
current-instantiation.cpp The member classes of a current instantiation aren't necessarily a 2011-02-19 19:24:40 +00:00
deduction-crash.cpp Push nested-name-specifier source-location information into dependent 2011-03-02 00:47:37 +00:00
deduction.cpp When printing a qualified type, look through a substituted template 2011-02-17 06:52:25 +00:00
default-arguments-cxx0x.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
default-arguments.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
default-expr-arguments-2.cpp Tweak GetPreamblePCHPath() to more closely match the behavior of the 2010-09-11 17:51:16 +00:00
default-expr-arguments.cpp Enhance the diagnostic for negative array sizes to include the 2011-01-04 04:44:35 +00:00
dependent-base-classes.cpp When we run into an error parsing or type-checking the left-hand side 2010-09-17 22:25:06 +00:00
dependent-base-member-init.cpp PR7698: Make sure we correctly handle the initialization of an array with 2010-07-24 21:19:15 +00:00
dependent-class-member-operator.cpp PR7837: For qualified id's, make sure the decl context is complete if not 2010-08-06 23:41:47 +00:00
dependent-expr.cpp Don't try to compute the value of a value-dependent expression when 2010-12-21 07:22:56 +00:00
dependent-names.cpp Improve our handling of the current instantiation for qualified 2011-02-04 13:35:07 +00:00
dependent-sized_array.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
dependent-template-recover.cpp When constructing source-location information for a 2011-03-04 18:53:13 +00:00
dependent-type-identity.cpp When computing the canonical profile of a DeclRefExpr or MemberExpr, 2010-07-13 08:37:11 +00:00
destructor-template.cpp Diagnose destructor templates. Fixes PR7904. 2011-03-04 22:45:55 +00:00
elaborated-type-specifier.cpp Tag references shouldn't ever get template parameter lists. 2010-10-19 18:40:57 +00:00
enum-argument.cpp Clarify the logic for when to build an overloaded binop. In particular, 2010-12-06 05:26:58 +00:00
enum-forward.cpp Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a 2010-10-08 23:50:27 +00:00
example-dynarray.cpp tests: Use %clangxx when using driver for C++, in case C++ support is disabled. 2010-06-29 16:52:24 +00:00
example-typelist.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
explicit-instantiation.cpp Not content to implement just "extern" explicit template 2010-12-01 20:32:20 +00:00
explicit-specialization-member.cpp Instantiate class member template partial specialization declarations 2010-11-10 19:44:59 +00:00
ext-vector-type.cpp Clean up the diagnostic complaining about the element type of a vector 2010-06-30 17:30:41 +00:00
extern-templates.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
fibonacci.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
friend-template.cpp Enhance the diagnostic for negative array sizes to include the 2011-01-04 04:44:35 +00:00
friend.cpp Fix a crash-on-invalid involving name lookup of tag names, where we 2010-04-12 16:00:01 +00:00
fun-template-def.cpp 'const std::type_info*' instead of 'std::type_info const*' 2010-09-05 00:17:29 +00:00
function-template-specialization.cpp Disallow function template partial specializations, from Hans 2011-01-24 18:54:39 +00:00
implicit-instantiation-1.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
inject-templated-friend-post.cpp Switch to using %clang_cc1 properly rather than manually passing the -cc1 flag. 2010-11-13 10:19:35 +00:00
inject-templated-friend.cpp Switch to using %clang_cc1 properly rather than manually passing the -cc1 flag. 2010-11-13 10:19:35 +00:00
injected-class-name.cpp When we start the definition of a class template, set the 2010-04-30 04:39:27 +00:00
instantiate-anonymous-union.cpp When building a qualified reference to a member of an anonymous struct 2011-02-18 02:44:58 +00:00
instantiate-array.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-attr.cpp Instantiate attributes from the pattern record when instantiating 2010-08-01 02:01:53 +00:00
instantiate-c99.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-call.cpp Introduce a centralized routine in Sema for diagnosing failed lookups (when 2009-12-16 08:11:27 +00:00
instantiate-case.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-cast.cpp Implement appropriate semantics for C++ casting and conversion when 2011-04-15 17:59:54 +00:00
instantiate-clang.cpp Continue to instantiate sub-statements in a CompoundStmt as long as 2010-08-27 19:56:05 +00:00
instantiate-complete.cpp When we're type-checking the result of calling a conversion function 2010-11-13 19:36:57 +00:00
instantiate-decl-dtor.cpp Make sure we instantiate the destructor for variables initialized by 2009-12-20 22:29:11 +00:00
instantiate-decl-init.cpp A dependent initializer with zero arguments should return a NULL 2010-02-05 07:56:11 +00:00
instantiate-declref-ice.cpp Implement support for variable length arrays in C++. VLAs are limited 2010-05-22 16:17:30 +00:00
instantiate-declref.cpp Implicit decl ref expressions might not have name locations; don't silently 2010-08-17 21:27:17 +00:00
instantiate-deeply.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-default-assignment-operator.cpp Enhance the diagnostic for negative array sizes to include the 2011-01-04 04:44:35 +00:00
instantiate-dependent-nested-name.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-elab-type-specifier.cpp Change the representation of dependent elaborated-type-specifiers 2010-03-31 22:19:08 +00:00
instantiate-enum-2.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-enum.cpp When instantiating a function-scoped enum, make sure that it and its 2010-03-01 19:00:07 +00:00
instantiate-exception-spec.cpp When pretty-printing tag types, only print the tag if we're in C (and 2010-03-10 11:27:22 +00:00
instantiate-expr-1.cpp When pretty-printing tag types, only print the tag if we're in C (and 2010-03-10 11:27:22 +00:00
instantiate-expr-2.cpp When transforming a C++ "new" expression's constructor arguments, drop 2010-05-26 07:10:06 +00:00
instantiate-expr-3.cpp Continue to instantiate sub-statements in a CompoundStmt as long as 2010-08-27 19:56:05 +00:00
instantiate-expr-4.cpp Add -fcxx-exceptions to all tests that use C++ exceptions. 2011-02-28 00:40:07 +00:00
instantiate-expr-5.cpp Fix template instantiation for __builtin_offfsetof expressions that refer to members of anonymous structs/unions 2010-04-28 22:43:14 +00:00
instantiate-expr-basic.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-field.cpp Before checking bitfield initialization, make sure that neither the 2011-02-04 13:09:01 +00:00
instantiate-friend-class.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-function-1.cpp Add -fcxx-exceptions to all tests that use C++ exceptions. 2011-02-28 00:40:07 +00:00
instantiate-function-1.mm Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-function-2.cpp Given Decl::isUsed() a flag indicating when to consider the "used" 2010-06-17 23:14:26 +00:00
instantiate-function-params.cpp When instantiating a function that was declared via a typedef, e.g., 2010-05-04 18:18:31 +00:00
instantiate-init.cpp When pulling apart an initializer that involves a CXXConstructExpr, do 2010-03-24 21:22:47 +00:00
instantiate-invalid.cpp Robustify instantiation of templates when there are errors in the 2010-03-01 18:27:54 +00:00
instantiate-local-class.cpp For member pointer conversions potentially involving derived-to-base 2010-12-21 21:40:41 +00:00
instantiate-member-class.cpp We may fail to map a declaration in a template to its instantiated 2011-03-06 20:12:45 +00:00
instantiate-member-expr.cpp Enhance the diagnostic for negative array sizes to include the 2011-01-04 04:44:35 +00:00
instantiate-member-initializers.cpp Diagnose misordered initializers in constructor templates immediately instead of 2010-04-10 07:37:23 +00:00
instantiate-member-pointers.cpp Enhance the diagnostic for negative array sizes to include the 2011-01-04 04:44:35 +00:00
instantiate-member-template.cpp When transforming a dependent template specialization type, make sure 2011-03-07 02:33:33 +00:00
instantiate-method.cpp When instantiating a member function declared via a typedef, don't try 2010-05-03 15:32:18 +00:00
instantiate-non-dependent-types.cpp When we encounter a non-dependent type during template instantiation, 2010-05-07 23:12:07 +00:00
instantiate-non-type-template-parameter.cpp When we're creating an expression for an integral template argument of 2011-02-18 02:12:44 +00:00
instantiate-objc-1.mm Provide an Objective C mangling for wchar_t. Patch by Nico Weber! 2010-06-11 10:11:05 +00:00
instantiate-overload-candidates.cpp Add a test for a subtle instantiation pattern that showed up within a Boost 2010-05-11 08:02:08 +00:00
instantiate-overloaded-arrow.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-static-var.cpp When printing a qualified type, look through a substituted template 2011-02-17 06:52:25 +00:00
instantiate-subscript.cpp Improve the lead diagnostic for C++ object subscript expressions with 2010-01-07 02:04:15 +00:00
instantiate-template-template-parm.cpp Add test for PR8629 2011-01-25 18:11:52 +00:00
instantiate-try-catch.cpp Add -fcxx-exceptions to all tests that use C++ exceptions. 2011-02-28 00:40:07 +00:00
instantiate-type.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiate-typedef.cpp Make CXXScopeSpec invalid when incomplete, and propagate that into any 2010-04-08 16:38:48 +00:00
instantiate-using-decl.cpp Fix handling of dependent nested namespace specifiers in UsingDecls 2010-09-29 17:58:28 +00:00
instantiation-backtrace.cpp When pretty-printing tag types, only print the tag if we're in C (and 2010-03-10 11:27:22 +00:00
instantiation-default-1.cpp make clang print types as "const int *" instead of "int const*", 2010-09-05 00:04:01 +00:00
instantiation-default-2.cpp Overhaul checking of non-type template arguments that should refer to 2010-04-01 18:32:35 +00:00
instantiation-default-3.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
instantiation-depth.cpp Reword the note we emit when suppressing template instantiation contexts, per John's advice 2010-04-21 05:40:43 +00:00
issue150.cpp When substituting in for a template name, do not produce a qualified 2011-03-05 20:06:51 +00:00
member-access-ambig.cpp When we perform name lookup for a template, we may end up finding an 2010-10-22 17:36:51 +00:00
member-access-expr.cpp Clarify the logic for when to build an overloaded binop. In particular, 2010-12-06 05:26:58 +00:00
member-function-template.cpp Canonicalize template template parameters when canonicalizing a 2010-06-16 21:09:37 +00:00
member-initializers.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
member-template-access-expr.cpp When performing template name lookup for a dependent member access 2010-07-16 16:54:17 +00:00
metafun-apply.cpp When pretty-printing tag types, only print the tag if we're in C (and 2010-03-10 11:27:22 +00:00
nested-linkage.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
nested-name-spec-template.cpp Don't ask if a depenendent CXXRecordDecl has any dependent bases 2011-03-11 23:27:41 +00:00
nested-template.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
operator-function-id-template.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
operator-template.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
overload-candidates.cpp Record template argument deduction failures for member function 2010-05-08 20:18:54 +00:00
overload-uneval.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
partial-spec-instantiate.cpp Partial and full specializations of a class template may have a 2010-05-06 00:28:52 +00:00
qualified-id.cpp Turn access control on by default in -cc1. 2010-04-09 19:03:51 +00:00
qualified-names-diag.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
recovery-crash.cpp Add a workaround for PR7947, a crash trying to recover from invalid C++ code. 2010-08-20 20:54:15 +00:00
recursive-template-instantiation.cpp Note that an overload candidate was non-viable because template argument 2010-02-01 18:53:26 +00:00
resolve-single-template-id.cpp Simplify calling CheckPlaceholderExpr, converge on it in a few places, 2011-04-10 19:13:55 +00:00
self-comparison.cpp Lay the ground work for resoving PR7047. This doesn't actually fix it because 2010-07-10 12:30:03 +00:00
temp.cpp If filtering a lookup result leaves it ambiguous, keep the ambiguity 2010-08-28 20:17:00 +00:00
temp_arg.cpp Explain that a template needs arguments to make it into a type, for 2010-04-08 21:04:54 +00:00
temp_arg_nontype.cpp Improve bool and char integral template argument printing in 2011-02-19 00:21:00 +00:00
temp_arg_template.cpp Detect when the string "<::" is found in code after a cast or template name and is interpreted as "[:" because of the digraph "<:". When found, give an error with a fix-it to add whitespace between the "<" and "::". 2011-04-14 21:45:45 +00:00
temp_arg_type.cpp Allow anonymous and local types. The support was already in place for these, 2010-09-03 21:12:34 +00:00
temp_class_order.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
temp_class_spec.cpp Implement a specific diagnostic when a class template partial 2010-02-09 00:37:32 +00:00
temp_class_spec_blocks.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
temp_class_spec_neg.cpp When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade the 2010-09-12 05:24:55 +00:00
temp_explicit.cpp The C++98/03 standard is disturbingly silent about out-of-scope 2010-05-11 17:39:34 +00:00
temp_explicit_cxx0x.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
temp_func_order.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
template-class-traits.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
template-decl-fail.cpp It's okay to reference an enum in a template definition, even though 2010-05-03 17:48:54 +00:00
template-id-expr.cpp Fix the recently-added warning about 'typename' and 'template' 2010-06-16 22:31:08 +00:00
template-id-printing.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
typename-specifier-2.cpp Switch file-scope assignment initialization over to InitializationSequence. 2009-12-22 02:10:53 +00:00
typename-specifier-3.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
typename-specifier-4.cpp When building a type for a typename specifier, check specifically for 2011-03-01 16:44:30 +00:00
typename-specifier.cpp Fix the recently-added warning about 'typename' and 'template' 2010-06-16 22:31:08 +00:00
typo-dependent-name.cpp When determining whether a given name is a template in a dependent 2010-01-12 17:06:20 +00:00
unused-variables.cpp Improve our handling of the -Wunused-variable warning in templates. In 2010-05-08 23:05:03 +00:00
value-dependent-null-pointer-constant.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
virtual-member-functions.cpp Rework when and how vtables are emitted, by tracking where vtables are 2010-05-13 16:44:06 +00:00