ogoffart added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:5044-5045
@@ -5043,4 +5043,4 @@
   // function template specialization, add it to the scope stack.
-  if (New->getDeclName() && AddToScope &&
-       !(D.isRedeclaration() && New->isInvalidDecl())) {
+  if (New->getDeclName() && AddToScope && !(D.isRedeclaration()
+      && New->isInvalidDecl() && !D.isFunctionDefinition())) {
     // Only make a locally-scoped extern declaration visible if it is the first
----------------
rsmith wrote:
> Can we delete the invalid-decl check entirely here? If it's doing something 
> important, we need to figure out what and make sure we preserve that intent 
> if it's important, but either way it doesn't make a lot of sense to me for 
> this to depend on whether the declaration has a definition.
I tried that, but then we have a failure in Sema/function-redecl.c and 
Sema/predefined-function.c


  int eli(float b); // expected-note {{previous declaration is here}} \
  int foo() {
    int eli(int (int)); // expected-error {{conflicting types for 'eli'}}
    eli(b); // expected-error{{passing 'int (int)' to parameter of incompatible 
type 'float'}}
     return 0;
   }

If we keep the invalid declaration, there would not be an error in the call to 
eli(b)

But is that a behaviour we would change?
  


http://reviews.llvm.org/D19327



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to