- Feb 01, 2019
-
-
Brian Gesiak authored
Summary: Given the following test program: ``` class C { public: int A(int a, int& b); }; int C::A(const int a, int b) { return a * b; } ``` Clang would produce an error message that correctly diagnosed the redeclaration of `C::A` to not match the original declaration (the parameters to the two declarations do not match -- the original takes an `int &` as its 2nd parameter, but the redeclaration takes an `int`). However, it also produced a note diagnostic that inaccurately pointed to the first parameter, claiming that `const int` in the redeclaration did not match the unqualified `int` in the original. The diagnostic is misleading because it has nothing to do with why the program does not compile. The logic for checking for a function overload, in `Sema::FunctionParamTypesAreEqual`, discards cv-qualifiers before checking whether the types are equal. Do the same when producing the overload diagnostic. Reviewers: rsmith Reviewed By: rsmith Subscribers: cpplearner, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57032 llvm-svn: 352831
-
- Jun 16, 2016
-
-
Olivier Goffart authored
This code should be an error: void foo(int); void f3() { int foo(float); { float foo(int); // expected-error {{functions that differ only in their return type cannot be overloaded}} } } the foo(float) function declared at function scope should not hide the float(int) while trying to redeclare functions. Differential Revision: http://reviews.llvm.org/D19763 llvm-svn: 272961
-
- Sep 20, 2013
-
-
Richard Smith authored
variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
-
- Aug 13, 2013
-
-
Richard Smith authored
When a local extern declaration redeclares some other entity, the type of that entity is merged with the prior type if the prior declaration is visible (in C) or is declared in the same scope (in C++). - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right set of cases, and make it track whether it found a shadowed declaration. - Track whether we found a declaration in the same scope (for C++) including across serialization and template instantiation. llvm-svn: 188307
-
- Mar 12, 2013
-
-
Rafael Espindola authored
llvm-svn: 176888
-
Rafael Espindola authored
extern "C" { void test5_f() { extern int test5_b; } } static float test5_b; This patch makes us report one for extern "C" { void test6_f() { extern int test6_b; } } extern "C" { static float test6_b; } Not because we think the declaration would be extern C, but because of the rule: An entity with C language linkage shall not be declared with the same name as an entity in global scope... We were just not looking past the extern "C" to see if the decl was in global scope. llvm-svn: 176875
-
Rafael Espindola authored
Without this patch we produce an error for extern "C" { void f() { extern int b; } } extern "C" { extern float b; } but not for extern "C" { void f() { extern int b; } } extern "C" { float b; } llvm-svn: 176867
-
- Jan 11, 2013
-
-
Rafael Espindola authored
Before we were only checking if the new declaration itself was marked extern C. Fixes prpr14766. llvm-svn: 172243
-
- Jun 08, 2012
-
-
Kaelyn Uhrain authored
correction to use for an invalid function redeclaration. llvm-svn: 158177
-
- Apr 03, 2012
-
-
Nick Lewycky authored
a view over the contents of a DeclContext without exposing the implementation details of the StoredDeclsMap. Use this in LookupVisibleDecls to find the visible declarations. Fixes PR12339! llvm-svn: 153970
-
- Oct 11, 2011
-
-
Kaelyn Uhrain authored
llvm-svn: 141609
-
- Oct 10, 2011
-
-
Kaelyn Uhrain authored
llvm-svn: 141555
-
- Sep 14, 2011
-
-
Kaelyn Uhrain authored
llvm-svn: 139718
-
- Aug 23, 2011
-
-
Matt Beaumont-Gay authored
For the test case added to function-redecl.cpp, we were previously complaining about a mismatch in the parameter types, since the definition used the typedef'd type. llvm-svn: 138318
-
- Aug 18, 2011
-
-
Kaelyn Uhrain authored
uncorrected identifier. Fixes a problem pointed out by Eli. llvm-svn: 137987
-
Kaelyn Uhrain authored
diagnosing invalid function redeclarations. llvm-svn: 137966
-
- Dec 15, 2009
-
-
Daniel Dunbar authored
- This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
-
- Mar 24, 2009
-
-
Daniel Dunbar authored
Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
-
- Feb 24, 2009
-
-
Douglas Gregor authored
- When we are declaring a function in local scope, we can merge with a visible declaration from an outer scope if that declaration refers to an entity with linkage. This behavior now works in C++ and properly ignores entities without linkage. - Diagnose the use of "static" on a function declaration in local scope. - Diagnose the declaration of a static function after a non-static declaration of the same function. - Propagate the storage specifier to a function declaration from a prior declaration (PR3425) - Don't name-mangle "main" llvm-svn: 65360
-