- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.This (ICL 12.1.4.325,/Wall):[cpp]template< unsigned threshold > bool fn( unsigned n ) { return n >= threshold; } int main() { fn< 1 >( 123 ); // ok fn< 0 >( 123 ); // warning #186: pointless comparison of unsigned integer with zero return 0; } [/cpp] Is the compiler suggesting that a separate specialization is needed for threshold==0? I think template arguments should be treated more like function arguments with regard to raising this diagnostic message, and less like literals.On another note, I'm still wondering about a minor point from one of my previous posts which was left uncommented probably due to not being stated clear enough. Here, of all the functions, only f1 gets "warning #2536: type qualifiers are meaningless here". It looks like there is some inconsistency regarding this warning.[cpp]#include template< typename ptype > auto f1( ptype ptr ) -> decltype( *ptr ) const { return *ptr; } template< typename ptype > auto f2( ptype ptr ) -> int const { return *ptr; } template< typename ptype > std::remove_pointer< ptype >::type const f3( ptype ptr ) { return *ptr; } template< typename ptype > int const f4( ptype ptr ) { return *ptr; } int const f9( int *ptr ) { return *ptr; } void test() { int x = 123; f1( &x ); f2( &x ); f3( &x ); f4( &x ); f9( &x ); } [/cpp] ----Best regards,Vladimir
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
http://software.intel.com/en-us/forums/showthread.php?t=105398&o=a&s=lr
There is something wrongwithanalysis of 'unsigned int' variables by Intel C++ compiler in your and my cases.
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With regards to the second issue (the lack of warning for late specified return types):
(1) On Windows you will see a diagnostic for f4() and f9() if you add the following command line option:
!% icl -c /Qdiag-warning:858 f2.cpp
Intel C++ Compiler XE for applications running on IA-32, Version Mainline Bet
a Build x
Built Jun 9 2012 20:04:48 by jward4 on JWARD4-DESK in D:/workspaces/cfe/dev
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
f2.cpp
f2.cpp(19): warning #858: type qualifier on return type is meaningless
int const f4( ptype ptr ) {
^
f2.cpp(23): warning #858: type qualifier on return type is meaningless
int const f9( int *ptr ) {
^
f2.cpp(4): warning #2536: type qualifiers are meaningless here
auto f1( ptype ptr ) -> decltype( *ptr ) const {
^
detected during instantiation of "f1" based on template argument
*> at line 29
Diagnostic 858 is only a remark by default on Windows which is why you need to
explicitenable it to see it.We should probably do the same (downgrade the diag to a remark)
with diagnostic 2536 since we have lots of complaints about our Windows compiler issuing more
warnings than Microsoft's. I have entered DPD200232951 for us to do that.
(2) It does look like there is still an inconsistency in that we don't give a diagnostic for f2().
I have entered that into our bug tracking database as DPD200232950. Thank you for reporting it.
thanks,
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi to everyone on the thread.
The issue Judy entered about diagnostic 2536 should not be emitted under /Wall is resolved in our Composer XE 2013 compiler. You need to specify /W5 (our Intel compiler-specific highest diagnostic level) to enable it. The other issues/requests are still being worked.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page