public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
       [not found] <bug-27527-4@http.gcc.gnu.org/bugzilla/>
@ 2011-09-27 22:20 ` paolo.carlini at oracle dot com
  2011-09-28 19:38 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-27 22:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|gcc-bugs at gcc dot gnu.org |jason at gcc dot gnu.org

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-27 22:05:34 UTC ---
Jason, can you help analyzing a bit the complete testcase attached in Comment
#3? To date, I still see the EDG-based compilers I have at hand rejecting most
of the -DCASE, like GCC, and, on the other hand, does not look like matter of
passing down complain values...


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
       [not found] <bug-27527-4@http.gcc.gnu.org/bugzilla/>
  2011-09-27 22:20 ` [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug) paolo.carlini at oracle dot com
@ 2011-09-28 19:38 ` jason at gcc dot gnu.org
  2011-09-28 21:22 ` paolo.carlini at oracle dot com
  2011-12-30 13:13 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2011-09-28 19:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-09-28 19:26:19 UTC ---
14.9.2/8:

Only invalid types and expressions in the immediate context of the function
type and its template parameter types can result in a deduction failure. [
Note: The evaluation of the substituted types and expressions can result in
side effects such as the instantiation of class template specializations and/or
function template specializations, the generation of implicitly-defined
functions, etc. Such side effects are not in the “immediate context” and can
result in the program being ill-formed. — end note ]


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
       [not found] <bug-27527-4@http.gcc.gnu.org/bugzilla/>
  2011-09-27 22:20 ` [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug) paolo.carlini at oracle dot com
  2011-09-28 19:38 ` jason at gcc dot gnu.org
@ 2011-09-28 21:22 ` paolo.carlini at oracle dot com
  2011-12-30 13:13 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-28 21:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-28 21:09:59 UTC ---
Thanks, the "usual" misinterpretation, in other terms (honestly, in this
specific case I didn't look at the actual code closely enough to even try to
figure out myself).


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
       [not found] <bug-27527-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-09-28 21:22 ` paolo.carlini at oracle dot com
@ 2011-12-30 13:13 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-30 13:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |solodon at mail dot com

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-30 13:12:03 UTC ---
*** Bug 51710 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
  2006-05-09 21:28 [Bug c++/27527] New: " sebor at roguewave dot com
                   ` (2 preceding siblings ...)
  2006-05-12 16:31 ` sebor at roguewave dot com
@ 2006-05-26 15:14 ` bangerth at dealii dot org
  3 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2006-05-26 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bangerth at dealii dot org  2006-05-26 15:14 -------
Confirmed. Though it is worth mentioning that icc has the same "problem".


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-26 15:14:37
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
  2006-05-09 21:28 [Bug c++/27527] New: " sebor at roguewave dot com
  2006-05-10  1:07 ` [Bug c++/27527] " sebor at roguewave dot com
  2006-05-12 16:27 ` sebor at roguewave dot com
@ 2006-05-12 16:31 ` sebor at roguewave dot com
  2006-05-26 15:14 ` bangerth at dealii dot org
  3 siblings, 0 replies; 8+ messages in thread
From: sebor at roguewave dot com @ 2006-05-12 16:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sebor at roguewave dot com  2006-05-12 16:30 -------
Created an attachment (id=11446)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11446&action=view)
Corrected test program exercising SFINAE.

After modifying the test program from comment #1 to correct these problems most
test cases still fail (with both gcc and EDG eccp).
The modified test program is in the attachment.

Here's a script I used to run the test program:

$ (c=1; \
   while [ $c -lt 17 ]; do \
       printf "%s: " "$c"; \
       gcc -DCASE=$c t.cpp 2>/dev/null; \
       if [ $? -eq 0 ]; then echo okay; else echo ERROR; fi; \
       c=`expr $c + 1`; \
   done) 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
  2006-05-09 21:28 [Bug c++/27527] New: " sebor at roguewave dot com
  2006-05-10  1:07 ` [Bug c++/27527] " sebor at roguewave dot com
@ 2006-05-12 16:27 ` sebor at roguewave dot com
  2006-05-12 16:31 ` sebor at roguewave dot com
  2006-05-26 15:14 ` bangerth at dealii dot org
  3 siblings, 0 replies; 8+ messages in thread
From: sebor at roguewave dot com @ 2006-05-12 16:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sebor at roguewave dot com  2006-05-12 16:27 -------
EDG points out to me that both the original test case and the one from comment
#1 are ambiguous because only the declaration of the signature of the function
(and thus only the declaration of its return type and its arguments) is
required the be well-formed and not the definition. Since the declaration of
both A<int> and B<int> is well-formed in all cases the call is ambiguous.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug)
  2006-05-09 21:28 [Bug c++/27527] New: " sebor at roguewave dot com
@ 2006-05-10  1:07 ` sebor at roguewave dot com
  2006-05-12 16:27 ` sebor at roguewave dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: sebor at roguewave dot com @ 2006-05-10  1:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sebor at roguewave dot com  2006-05-10 01:07 -------
Here's a test case designed to exhaustively exercise all cases mentioned in
14.8.2, p2. Hope it helps.

$ cat ~/tmp/t.cpp && (c=1; while [ $c -lt 15 ]; do printf "%s: " "$c"; gcc
-DCASE=$c ~/tmp/t.cpp 2>/dev/null; if [ $? -eq 0 ]; then echo okay; else echo
ERROR; fi; c=`expr $c + 1`; done)
#if CASE == 1
  // attempting to create an array with an element type that is void
template <class, class U = void> struct A { typedef U X [1]; };
#elif CASE == 2
  // attempting to create an array with an element type that is function
template <class, class U = void ()> struct A { typedef U X [1]; };
#elif CASE == 3
  // attempting to create an array with an element type that is a reference
template <class, class U = T&> struct A { typedef U X [1]; };
#elif CASE == 4
  // attempting to create an array with size that is zero
template <class, int N = 0> struct A { typedef T X [N]; };
#elif CASE == 5
  // attempting to create an array with size that is negative
template <class, int N = -1> struct A { typedef T X [N]; };
#elif CASE == 6
  // attempting to use a type that is not a class type in a qualified name
template <class T> struct A { typedef typename T::X X; };
#elif CASE == 7
  // attempting to use a non-existent member type
template <class T, class U = T> struct A { typedef typename A<U>::X X; };
#elif CASE == 8
  // attempting to create a pointer to reference type
template <class T, class U = T&> struct A { typedef U* X; };
#elif CASE == 9
  // attempting to create a reference to reference type
template <class T, class U = T&> struct A { typedef U& X; };
#elif CASE == 10
  // attempting to create a reference to void type
template <class T, class U = void> struct A { typedef U& X; };
#elif CASE == 11
  // attempting to create a pointer to member of T when T is not class type
template <class T> struct A { typedef int T::*X; };
#elif CASE == 12
  // attempting to perform an invalid conversion
char ch; 
template <class T, T* = &ch> struct A { typedef T X; };
#elif CASE == 13
  // attempting to create a function type with a void parameter
template <class T, class U = void> struct A { typedef T X (U); };
#elif CASE == 14
  // attempting to create a cv-qualified function type
template <class T, class U = void ()> struct A { typedef U& X; };
#else
#  error CASE not #defined
#endif

template <class T> struct B { typedef T Y; };

template <class T>
A<T> foo (T);

template <class T>
B<T> foo (T) { return B<T>(); }

int main ()
{
    foo (0);
}

The output of running the script with gcc 4.1:

1: ERROR
2: ERROR
3: ERROR
4: ERROR
5: ERROR
6: ERROR
7: ERROR
8: ERROR
9: ERROR
10: ERROR
11: ERROR
12: okay
13: ERROR
14: ERROR


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27527


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-12-30 13:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-27527-4@http.gcc.gnu.org/bugzilla/>
2011-09-27 22:20 ` [Bug c++/27527] invalid types produced out of argument deduction (SFINAE bug) paolo.carlini at oracle dot com
2011-09-28 19:38 ` jason at gcc dot gnu.org
2011-09-28 21:22 ` paolo.carlini at oracle dot com
2011-12-30 13:13 ` paolo.carlini at oracle dot com
2006-05-09 21:28 [Bug c++/27527] New: " sebor at roguewave dot com
2006-05-10  1:07 ` [Bug c++/27527] " sebor at roguewave dot com
2006-05-12 16:27 ` sebor at roguewave dot com
2006-05-12 16:31 ` sebor at roguewave dot com
2006-05-26 15:14 ` bangerth at dealii dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).