[LLVMbugs] [Bug 14081] New: [microsoft] sema for __noop is fairly wrong

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 13 15:13:55 PDT 2012


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

             Bug #: 14081
           Summary: [microsoft] sema for __noop is fairly wrong
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Eli pointed out in an email that

template<typename T> static void f() { T x = 10; }
void g() { __noop(f<void>()); }

is an interesting case for __noop that compiles with cl but not with clang.

__noop has a few other interesting cases too:

* `int __noop = 4` is a syntax error in cl; __noop is a keyword

* `int a = __noop(42, 56);` assigns 0 to a, but so does `int a = __noop;`. All
of the following are valid, all but the first assign 0 to a:

  __noop;
  a = __noop;
  a = __noop();
  a = (__noop)();
  a = (__noop);
  a = (__noop());
  a = ((__noop)());
  a = ((__noop))();

* __noop is converted to pointers like a 0 literal:

  int (*f2)() = __noop;  // works, but just assings 0 to f2

* ...but it's not a constant expression:

  int arr[__noop() + 1];  // errors out

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list