hanchenye-llvm-project/clang/test/SemaTemplate
David Majnemer ea5092a3b0 Sema: Do not merge new decls with invalid, old decls
Sema::MergeFunctionDecl attempts merging two decls even if the old decl
is invalid.  This can lead to interesting circumstances where we
successfully merge the decls but the result makes no sense.

Take the following for example:

template <typename T>
int main(void);

int main(void);

Sema will not consider these to be overloads of the same name because
main can't be overloaded, which means that this must be a redeclaration.

In this case the templated decl is compatible with the non-templated
decl allowing the Sema::CheckFunctionDeclaration machinery to move on
and do bizarre things like setting the previous decl of a non-templated
decl to a templated decl!

The way I see it, we should just bail from MergeFunctionDecl if the old
decl is invalid.

This fixes PR16531.

llvm-svn: 185779
2013-07-07 23:49:50 +00:00
..
ackermann.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
address-spaces.cpp
alias-church-numerals.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
alias-nested-nontag.cpp
alias-template-template-param.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
alias-templates.cpp More for PR11848: a pack expansion type isn't necessarily type-dependent (its 2012-07-16 01:59:26 +00:00
alignas.cpp Handle alignas(foo...) pack expansions. 2013-02-22 08:32:16 +00:00
ambiguous-ovl-print.cpp
anonymous-union.cpp
array-to-pointer-decay.cpp [analyzer] Fix a crash that occurs when processing an rvalue array. 2013-06-06 00:19:36 +00:00
atomics.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
attributes.cpp Use attribute argument information to determine when to parse attribute arguments as expressions. 2013-05-02 23:25:32 +00:00
canonical-expr-type-0x.cpp PR12438: Profile a reference to a type template parameter by depth and index, 2012-04-02 18:53:24 +00:00
canonical-expr-type.cpp Sema: Do not merge new decls with invalid, old decls 2013-07-07 23:49:50 +00:00
class-template-ctor-initializer.cpp Don't produce diagnostics for missing ctor-initializers during template 2012-09-25 00:23:05 +00:00
class-template-decl.cpp Fix test failure. 2012-04-21 01:51:32 +00:00
class-template-id-2.cpp
class-template-id.cpp Add quotation marks to template names in diagnostics. 2013-03-05 06:21:38 +00:00
class-template-spec.cpp Change the diagnostics which said 'accepted as an extension' to instead say 2011-12-29 21:57:33 +00:00
constexpr-instantiate.cpp PR11851 (and duplicates): Whenever a constexpr function is referenced, 2012-11-07 01:14:25 +00:00
constructor-template.cpp
copy-ctor-assign.cpp
crash-8204126.cpp
crash-10438657.cpp When we're checking access in a dependent context, don't try to look 2011-11-14 23:00:43 +00:00
current-instantiation.cpp When rebuilding a DependentScopeDeclRefExpr, perform a lookup into the scope 2012-10-23 19:56:01 +00:00
deduction-crash.cpp Add 'not' to commands that are expected to fail. 2013-07-04 16:16:58 +00:00
deduction.cpp
default-arguments-cxx0x.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
default-arguments.cpp
default-expr-arguments-2.cpp Implement AST dumper for Decls. 2012-12-20 02:09:13 +00:00
default-expr-arguments.cpp PR14428: When instantiating a 'new' expression, if we had a non-dependent 2012-11-26 08:32:48 +00:00
delegating-constructors.cpp Make delegating initializers use a similar codepath to base initializers in dependent contexts. PR12890. 2012-05-19 23:35:23 +00:00
dependent-base-classes.cpp Recover properly if a class member declaration starts with a scope specifier 2012-05-09 08:23:23 +00:00
dependent-base-member-init.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
dependent-class-member-operator.cpp
dependent-expr.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
dependent-names-no-std.cpp
dependent-names.cpp Don't suggest putting 'operator new' or 'operator delete' in a namespace to fix a two-phase lookup issue. That's not permitted. 2013-06-12 22:56:54 +00:00
dependent-sized_array.cpp PR13788: Don't perform checks on the initializer of a dependently-typed 2012-11-09 23:03:14 +00:00
dependent-template-recover.cpp
dependent-type-identity.cpp
derived.cpp [test] Add test case for rdar://14183893. 2013-06-28 23:47:22 +00:00
destructor-template.cpp <rdar://problem/13140795> Transform the scope type of a pseudo-destructor expression within the object scope. 2013-03-08 21:25:01 +00:00
elaborated-type-specifier.cpp
enum-argument.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
enum-forward.cpp Shift Microsoft enum extensions from -fms-extensions to -fms-compatibility, so -fms-extensions doesn't affect enum semantics in incompatible ways. <rdar://problem/10657186>. 2012-02-16 05:20:44 +00:00
example-typelist.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
explicit-instantiation.cpp Implement warning for integral null pointer constants other than the literal 0. 2012-08-08 17:33:31 +00:00
explicit-specialization-member.cpp Add regression test for PR12331. 2013-07-02 18:08:50 +00:00
ext-vector-type.cpp
extern-templates.cpp
fibonacci.cpp
friend-template.cpp Flag that friend function definitions are "late parsed" so that 2013-03-14 05:13:41 +00:00
friend.cpp Modify how the -verify flag works. Currently, the verification string and 2011-12-15 00:38:15 +00:00
fun-template-def.cpp Fold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, each of which was only present in one version: 2013-03-28 00:03:10 +00:00
function-template-specialization.cpp Check a pointer is not null before attempting to use it. This prevents a 2013-05-16 02:14:08 +00:00
implicit-instantiation-1.cpp
inject-templated-friend-post.cpp Reland r160052: Default to -std=c++11 on Windows. 2012-08-30 02:08:31 +00:00
inject-templated-friend.cpp
injected-class-name.cpp
instantiate-anonymous-union.cpp
instantiate-array.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-attr.cpp Add missing check to warning for packed attribute. PR14259. 2012-11-07 00:35:20 +00:00
instantiate-c99.cpp
instantiate-call.cpp
instantiate-case.cpp
instantiate-cast.cpp
instantiate-clang.cpp
instantiate-complete.cpp --lies. 2012-02-10 09:37:07 +00:00
instantiate-decl-dtor.cpp
instantiate-decl-init.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-declref-ice.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-declref.cpp Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it. 2012-04-17 00:58:00 +00:00
instantiate-deeply.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-default-assignment-operator.cpp
instantiate-dependent-nested-name.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-elab-type-specifier.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-enum-2.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-enum.cpp
instantiate-exception-spec-cxx11.cpp Fix bug which sometimes resulted in further diagnostics being produced after a 2012-09-22 00:53:56 +00:00
instantiate-exception-spec.cpp
instantiate-expr-1.cpp Replace inline asm constraint "=a" by the more general constraint "=r". 2012-05-22 11:03:10 +00:00
instantiate-expr-2.cpp
instantiate-expr-3.cpp
instantiate-expr-4.cpp Fix crash due to missing array-to-pointer decay when instantiating an unresolved 2011-10-26 06:49:26 +00:00
instantiate-expr-5.cpp Fix crash-on-invalid: only use TransformAddressOfOperand when transforming the 2013-05-21 23:29:46 +00:00
instantiate-expr-basic.cpp
instantiate-field.cpp
instantiate-friend-class.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-function-1.cpp Promote the extension warning for attempts to catch a reference or 2012-01-24 19:01:26 +00:00
instantiate-function-1.mm
instantiate-function-2.cpp
instantiate-function-params.cpp
instantiate-init.cpp Improve 'failed template argument deduction' diagnostic for the case where we 2013-01-31 05:19:49 +00:00
instantiate-invalid.cpp
instantiate-local-class.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-member-class.cpp Implement DR85: Redeclaration of member is forbidden 2013-06-11 03:51:23 +00:00
instantiate-member-expr.cpp Unrevert r166268, reverted in r166272, with a fix for the issue which Nick 2012-10-21 03:28:35 +00:00
instantiate-member-initializers.cpp Fix regression in r170489: when instantiating a direct initializer which is a 2012-12-21 08:13:35 +00:00
instantiate-member-pointers.cpp
instantiate-member-template.cpp
instantiate-method.cpp Provide a special-case diagnostic when two class member functions instantiate 2012-07-13 04:12:04 +00:00
instantiate-non-dependent-types.cpp
instantiate-non-type-template-parameter.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-objc-1.mm Fix test cases broken by 155936. 2012-05-01 21:29:03 +00:00
instantiate-overload-candidates.cpp Implement DR61: Address of ambiguous bound methods should be disallowed 2013-06-11 03:56:29 +00:00
instantiate-overloaded-arrow.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-self.cpp During the instantiation of a class template specialization, that 2012-03-22 03:35:28 +00:00
instantiate-sizeof.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiate-static-var.cpp Change the diagnostics which said 'accepted as an extension' to instead say 2011-12-29 21:57:33 +00:00
instantiate-subscript.cpp
instantiate-template-template-parm.cpp
instantiate-try-catch.cpp
instantiate-type.cpp <rdar://problem/13094134> Don't try to wire up typedef names for invalid anonymous tag declarations encountered during template instantiation. 2013-03-08 22:15:15 +00:00
instantiate-typedef.cpp
instantiate-typeof.cpp A couple minor bug-fixes for template instantiation for expressions which are sometimes potentially evaluated. 2012-02-29 04:03:55 +00:00
instantiate-using-decl.cpp
instantiation-backtrace.cpp PR13365: Fix code which was trying to treat an array of DeducedTemplateArgument 2012-07-16 01:09:10 +00:00
instantiation-default-1.cpp
instantiation-default-2.cpp
instantiation-default-3.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
instantiation-depth-defarg.cpp PR13368: Halve the instantiation depth of this test again. Apparently, FreeBSD 2012-07-15 23:29:50 +00:00
instantiation-depth-exception-spec.cpp Fix bug which sometimes resulted in further diagnostics being produced after a 2012-09-22 00:53:56 +00:00
instantiation-depth-subst-2.cpp Fix bug which sometimes resulted in further diagnostics being produced after a 2012-09-22 00:53:56 +00:00
instantiation-depth-subst.cpp Fix bug which sometimes resulted in further diagnostics being produced after a 2012-09-22 00:53:56 +00:00
instantiation-depth.cpp Final piece of core issue 1330: delay computing the exception specification of 2012-07-27 04:22:15 +00:00
instantiation-order.cpp Track whether a function type has a trailing return type as type sugar. Use this 2012-02-10 09:58:53 +00:00
issue150.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
local-member-templates.cpp Fix the parser's updating of the template depth when parsing local templates and late-parsed templates. 2013-06-08 19:47:52 +00:00
lookup-dependent-bases.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
member-access-ambig.cpp PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers and 2012-08-18 00:55:03 +00:00
member-access-expr.cpp
member-function-template.cpp
member-inclass-init-value-dependent.cpp
member-initializers.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
member-template-access-expr.cpp Improve some of the conversion warnings to fire on conversion to bool. 2012-05-15 16:56:36 +00:00
metafun-apply.cpp
missing-class-keyword-crash.cpp
ms-function-specialization-class-scope.cpp Properly reenter multiple contexts when parsing a late-parsed function template 2013-04-29 08:53:40 +00:00
ms-if-exists.cpp Implement the Microsoft __if_exists/if_not_exists extension in initializer-list. 2011-12-12 23:24:39 +00:00
ms-lookup-template-base-classes.cpp Fix an assertion failure / accepts-invalid in -fms-extensions mode. Don't build 2013-04-29 08:45:27 +00:00
nested-incomplete-class.cpp Represent C++ direct initializers as ParenListExprs before semantic analysis 2012-02-11 23:51:47 +00:00
nested-linkage.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
nested-name-spec-template.cpp
nested-template.cpp Add test. 2013-06-20 20:56:57 +00:00
operator-function-id-template.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
operator-template.cpp Improve 'failed template argument deduction' diagnostic for the case where we 2013-01-31 05:19:49 +00:00
overload-candidates.cpp Part of PR15673: If a function template has a default argument in which 2013-07-04 01:01:24 +00:00
overload-uneval.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
partial-spec-instantiate.cpp
pragma-ms_struct.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
qualified-id.cpp Replace a FIXME with a diagnostic when we can't resolve the 2012-03-18 00:15:42 +00:00
qualified-names-diag.cpp
rdar9173693.cpp
recovery-crash.cpp Show fixit for unqualified calls to methods of dependent bases 2012-06-22 16:39:39 +00:00
recursive-template-instantiation.cpp Improve 'failed template argument deduction' diagnostic for the case where we 2013-01-31 05:19:49 +00:00
resolve-single-template-id.cpp Bound member function diagnostic - suggest no-args calls and note overload candidates 2013-06-04 00:28:46 +00:00
self-comparison.cpp
temp.cpp
temp_arg.cpp Add quotation marks to template names in diagnostics. 2013-03-05 06:21:38 +00:00
temp_arg_nontype.cpp <rdar://problem/13806270> A template argument list is a constant-evaluated context. 2013-05-03 23:44:54 +00:00
temp_arg_nontype_cxx11.cpp PR15360: nullptr as a non-type template argument to a function type non-type template parameter 2013-02-27 22:10:40 +00:00
temp_arg_template.cpp Correct test from r152189. 2012-03-07 01:13:38 +00:00
temp_arg_type.cpp Add quotation marks to template names in diagnostics. 2013-03-05 06:21:38 +00:00
temp_class_order.cpp
temp_class_spec.cpp
temp_class_spec_blocks.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
temp_class_spec_neg.cpp Change the diagnostics which said 'accepted as an extension' to instead say 2011-12-29 21:57:33 +00:00
temp_explicit.cpp Switch to the C++11 warning flags in tests. 2011-10-18 05:54:07 +00:00
temp_explicit_cxx0x.cpp
temp_func_order.cpp
template-class-traits.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
template-decl-fail.cpp
template-id-expr.cpp Fixed instantiation of DependentScopeDeclRefExpr. 2012-02-06 14:31:00 +00:00
template-id-printing.cpp Fixed instantiation of DependentScopeDeclRefExpr. 2012-02-06 14:31:00 +00:00
typename-specifier-2.cpp
typename-specifier-3.cpp
typename-specifier-4.cpp
typename-specifier.cpp Improvements to vexing-parse warnings. Make the no-parameters case more 2012-07-30 21:30:52 +00:00
typo-dependent-name.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
unresolved-construct.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
unused-variables.cpp
value-dependent-null-pointer-constant.cpp
virtual-member-functions.cpp One more cast test. 2013-06-20 01:47:05 +00:00