[LLVMbugs] [Bug 18475] New: Bogus message regarding use of "this" in friend declaration
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Tue Jan 14 11:07:11 PST 2014
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=18475
            Bug ID: 18475
           Summary: Bogus message regarding use of "this" in friend
                    declaration
           Product: clang
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified
The use of "this" in trailing-return-types and exception-specifications does
not work in friend declarations in Clang.
## SMALL SOURCE:
struct Other {
   int p();
   auto q() -> decltype(p()) *;
};
class Friendly {
   // according to 5.1.1 [expr.prim.general] paragraph 3 the expression "this"
   // below is a prvalue of type "pointer to Other".
   friend auto Other::q() -> decltype(this->p()) *;
      // GCC and ICC accepts, Clang rejects
};
## COMPILER INVOCATION:
clang++ -std=c++11 friendThis.cc 
## ACTUAL OUTPUT:
friendThis.cc:9:39: error: invalid use of 'this' outside of a non-static member
function
   friend auto Other::q() -> decltype(this->p()) *;
                                      ^
1 error generated.
## EXPECTED OUTPUT:
Clean compile.
## clang++ -v:
clang version 3.5 
Target: powerpc64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/ppc64-redhat-linux/3.4.6
Found candidate GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.6
Selected GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.6
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140114/d625d518/attachment.html>
    
    
More information about the llvm-bugs
mailing list