https://bugs.llvm.org/show_bug.cgi?id=50391

            Bug ID: 50391
           Summary: GCC Compat attribute 'mode' doesn't work on
                    type-aliases
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: erich.ke...@intel.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

Low priority since 'mode' is horrible and not particularly well used.

See: https://godbolt.org/z/jGEesvWeT

typedef int __attribute__((mode(QI)))  Type;
using AliasTy = int __attribute__((mode(QI)));

template<typename T>
void foo(){}

int main() {
    foo<Type>();
    foo<AliasTy>();
    foo<int>();
}


Presumably the attribute should work the same in the typedef as the type alias,
but it doesnt.  

The assembly is:
        call    void foo<signed char>()
        call    void foo<int>()
        call    void foo<int>()
instead of the 2nd also being a signed-char.


It is just silently ignored in a type-alias entirely, even for SEMA:
https://godbolt.org/z/YP9q3o1qv

Note how we get an error for the 1st line, but not the 2nd.



typedef int __attribute__((mode(DF)))  Type;
using AliasTy = int __attribute__((mode(DF)));

template<typename T>
void foo(){}

int main() {
    foo<Type>();
    foo<AliasTy>();
    foo<int>();
}

<source>:3:28: error: type of machine mode does not match type of base type
typedef int __attribute__((mode(DF)))  Type;


We even don't bother to check the contents at all!
https://godbolt.org/z/Mrfxqzaba

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to