-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[microsoft] sema for __noop
is fairly wrong
#14453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
More fun: #include <typeinfo>
#include <iostream>
#include <stdio.h>
using namespace std;
template<typename T> static void f() { T x = 10 asdf asdf asd asdf }
void g() { __noop(f<void>()); }
class A {
public:
void f();
};
int main() {
//&__noop;
int a[__noop(4 asdfasdf^*^&$^)(4, 5) + 1];
decltype(__noop) ac;
ac = 4;
void (A::*foo)() = __noop;
cout << typeid(__noop).name() << endl;
} (Note that it's a |
Hm, unfortunately I didn't notice this bug, so I rediscovered all these wonderful features a few months ago. I added support for paren-less |
I’m working on this issue to make -- |
__noop
is fairly wrong
@llvm/issue-subscribers-clang-frontend Author: Nico Weber (nico)
| | |
| --- | --- |
| Bugzilla Link | [14081](https://llvm.org/bz14081) |
| Version | unspecified |
| OS | All |
| Blocks | llvm/llvm-project#14079 |
| Attachments | [as UnaryExprOrTypeTrait](https://user-images.githubusercontent.com/3487/143746161-5d61078b-04e5-4314-ae07-230774ebc69c.gz), [As builtin with special handling](https://user-images.githubusercontent.com/3487/143746162-fd25f418-05d7-4b31-bae3-b29011473dc6.gz) |
| CC | @DougGregor,@zmodem,@tritao,@rnk |
Extended DescriptionEli 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;
a = __noop;
a = __noop();
a = (__noop)();
a = (__noop);
a = (__noop());
a = ((__noop)());
a = ((__noop))();
int (*f2)() = __noop; // works, but just assings 0 to f2
int arr[__noop() + 1]; // errors out |
Extended Description
Eli pointed out in an email that
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 keywordint a = __noop(42, 56);
assigns 0 to a, but so doesint a = __noop;
. All of the following are valid, all but the first assign 0 to a:__noop
is converted to pointers like a 0 literal:The text was updated successfully, but these errors were encountered: