]> granicus.if.org Git - clang/commitdiff
13.1-p3 Overloadable declarations
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 29 Sep 2009 20:28:06 +0000 (20:28 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 29 Sep 2009 20:28:06 +0000 (20:28 +0000)
Parameter declarations that differ only in the presence or absence of const and/or volatile are equivalent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83104 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
test/SemaCXX/function-overloaded-redecl.cpp [new file with mode: 0644]
test/SemaCXX/overloaded-operator.cpp

index 14c71af934c912954d07e0411dc4645ebcb8773c..60220834dba693b948b1196a4ce4f55ea19cebb6 100644 (file)
@@ -3683,8 +3683,10 @@ public:
   QualType adjustFunctionParamType(QualType T) const {
     if (!Context.getLangOptions().CPlusPlus)
       return T;
-
-    return T.getUnqualifiedType();
+    return 
+      T->isDependentType() ? T.getUnqualifiedType()
+                            : T.getDesugaredType().getUnqualifiedType();
+    
   }
 
   /// \name Code completion
diff --git a/test/SemaCXX/function-overloaded-redecl.cpp b/test/SemaCXX/function-overloaded-redecl.cpp
new file mode 100644 (file)
index 0000000..4d8e57c
--- /dev/null
@@ -0,0 +1,10 @@
+// RUN: clang-cc -fsyntax-only -verify %s 
+
+typedef const int cInt;
+
+void f (int); 
+void f (const int);  // redecl
+
+void f (int) {  }    // expected-note {{previous definition is here}}
+void f (cInt) { }    // expected-error {{redefinition of 'f'}}
+
index 02b47bd7b1973ed4c48aeffac086bbb5618fb4f2..77b5d6c701087c57d533ec769864998f62ead82e 100644 (file)
@@ -155,7 +155,7 @@ typedef INTREF Func1(FLOAT, double);
 typedef float& Func2(int, double);
 
 struct ConvertToFunc {
-  operator Func1*(); // expected-note{{conversion candidate of type 'INTREF (*)(FLOAT, double)'}}
+  operator Func1*(); // expected-note{{conversion candidate of type 'INTREF (*)(float, double)'}}
   operator Func2&(); // expected-note{{conversion candidate of type 'float &(&)(int, double)'}}
   void operator()();
 };