[LLVMbugs] [Bug 17747] New: member function `void foo() __restrict__; ` incorrectly applies restrict to type, not pointer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 30 21:07:15 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17747

            Bug ID: 17747
           Summary: member function `void foo() __restrict__;` incorrectly
                    applies restrict to type, not pointer
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: silvas at purdue.edu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

struct Foo {
  void member() __restrict__ {
    Foo *__restrict__ This = this;
  }
};

Clang gives the diagnostic:

test.cpp:3:23: error: cannot initialize a variable of type 'Foo *restrict' with
      an rvalue of type 'restrict Foo *'
    Foo *__restrict__ This = this;
                      ^      ~~~~
1 error generated.

Clang seems to think that `this` has type `restrict Foo *` (restrict on Foo,
rather than the pointer)

The GCC extension says:

<http://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html#Restricted-Pointers>

"Within the body of T::fn, this has the effective definition T *__restrict__
const this."

-- 
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/20131031/17b05cc9/attachment.html>


More information about the llvm-bugs mailing list