================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace InitPriorityAttribute {
----------------
to268 wrote:

> This test is weird? The error I see is based on using it at file-scope:
> https://godbolt.org/z/WjaEqoPda

The [code example](https://godbolt.org/z/bE41j1xx6) comes from in the 
discussion feed of [issue 
#129631](https://github.com/llvm/llvm-project/issues/129631#issuecomment-2796934135).
 The test code is nested inside a namespace, but it does not alter the behavior.

> Can you explain why this patch is a good example of what your problem is?

Basically, we emit the file-scope error diagnostic because we are unable to 
know the deduced type at the time we handle attributes. By delaying the check 
to the Sema phase after deducing the type, we are able to check if the 
underlying type is actually a`RecordType`. I should have clarified it better 
earlier.

> I would also like to see a test where init_priority is being used on 
> something actually dependent on a template parameter.

Thanks! I did not though of utilizing templates.

https://github.com/llvm/llvm-project/pull/182208
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to